His counting is an indication of OCD--Obsessive Compulsive Disorder. Some behavior modification will help him in learning how to manage this disorder--before it manages him and makes his life miserable. It will never totally go away, but behavior modification will give him the tools he'll need to reign in his impulses/compulsiveness.
My husband has this. It's awful. If you can get your son help now, as a youngster, he'll thank you immensely. My husband's dad actually made his situation worse. He thought it was funny that my husband would obsess over things--so he made sure to egg him on. Did you close the horse barn door for the evening? Not sure, so my husband would get up numerous times during the night to "go and check." If he was concerned/worried about something and wouldn't stop thinking or talking about it, his father would egg him on until he'd worked himself into a high state of anxiety and would physically make himself sick. His father thought it was funny, never realizing the awful, awful mess he was making for his son in later life.
I had a friend who would sit and stare at her living room curtains for hours on end, wondering if one side of the curtains was longer than the other side. After she'd spent several days doing this and many hours, she caught herself one day and said to herself, really? Seriously? She knew she had a problem and went and got help.
Thankfully your son let you know the issue, so now you can get him help. Yeah!