MOD = 10 ** 9 + 7 INF = 10 ** 10 import sys sys.setrecursionlimit(100000000) def sieve(n): primes = [1 if i%2 == 1 else 0 for i in range(n + 1)] primes[1] = 0 primes[2] = 1 for i in range(3,n + 1,2): if i * i > n: break if primes[i]: for j in range(i * i,n + 1,i): primes[j] = 0 return sum(p for p in range(2,n + 1) if primes[p] == 1) def main(): N = int(input()) print(sieve(N)) if __name__ == '__main__': main()