The number of integer points close to a curve