No way!  It’s no more illegal than using your own brain to add up how much you need to tip your server in a restaurant!  Casinos try to catch successful card counters and ban them, but that’s only policy, there’s no law against counting in your head.
Check out this case from 2000 where the Nevada Supreme Court ordered the Monte Carlo Casino in Las Vegas to pay a card counter the over $40,000 he had won counting cards!