Dogs can count, new study reveals