The first 'counting machine' certainly was that delivered by mother nature in form of the fingers and toes.

There are 10 fingers and looking at the hands we can see the fingers grouped into 4 + 2 (the thumbs) + 4 = 10. As far as I know this fundamental fact is not something you learn in contemporary schools of the Western Civilization, but we can be assured the schools of ancient man did not miss to make use of it. With an even number there must be two central units.

At a more advanced stage the knuckles could be used:

(Ref.: Ifrah)