added solution to bean counting