Count the number of primes up to some number N.