import math def primes(n): res = set(range(2, n + 1)) for i in range(2, int(math.sqrt(n) + 1)): res.difference_update(range(i * 2, n + 1, i)) return list(res) N = int(input()) print(sum(primes(N)))