Interleaving Logic and Counting