Counting lattice points and o-minimal structures