so it might be used ironically - 'I know how many beans make five' literally means 'I know something very simple' but probably implies 'I'm very smart indeed'.
My mum also used to say 'he knows how many beans make five' meaning someone knew what was going on or should know better than to do something wrong or bad, i.e. he's not stupid.