During the course of normal brain development, what comes first:
- logical thinking or
Counting, easily. It's a matter of rote and repetition, dominated by procedural learning. Critical thinking requires more advanced circuitry and learning. There is a lot of really rapid neural development still occurring in the first couple years and children are learning from society and parents and experience in the meantime. During this time, they can easily count and say the alphabet.
Logical thinking isn't apparent until around 3 or 4, though I suppose a robust discussion would require a formal definition of what constitutes logic.
For a real answer on this topic, you need two things: one is to understand your question, and the other is an understanding of Jean Piaget's masses of research into the development of intelligence (from birth to adulthood). Regarding understanding your own question, you must appreciate that decades of philosophy and psychology reveal that you cannot separate logic from mathematics. Even at the simplest of levels , young children around 4 years old will demonstrate semi-logical skills together with primitive counting skills. The reason for all this is that the level of abstraction above perception (i.e. in thinking) required for both logic and number is the same, and there is a hierarchy of such abstractions that can be traced throughout the development of intelligence common to every individual. Jean Piaget is the one you want to read, and epistemology (study of knowledge) is the domain you are asking about.
Logical Thinking is a very broad class of phenomena whereas counting is a very specific one. Logical Thinking dependes on the invidual having logical operations, which follow a course of development from early childhood, as proposed by Piaget. Counting itself has been a subject of research that shows that indeed young children can learn to count without understanding what number is. For example, a child may count two rows of items and count both as having "six", yet when one of such rows's elements are spaced, thereby removing the optical correspondence between the items, that same child will deny that both rows still have the same amount. A review of this research and other topics related to early mathematics learning can be found in http://www.nuffieldfoundation.org/sites/default/files/P2.pdf