Add count calculation API for button pressed/released