bean counting program