Mechanical counting machine