#include <iostream>

using namespace std;

#define MAX_PRIME 20000000

long long int sum = 0;
int noPrimes = 0;
bool isNotPrime[MAX_PRIME]= {};

void count()
{
  for (int i = 2; i < MAX_PRIME; i++)
  {
  	if (!isNotPrime[i])
  	{
  	  for (int j = i + i; j < MAX_PRIME; j += i)
  	  {
  	    isNotPrime[j] = true;
  	  }
  	  noPrimes++;
  	  sum += i;
  	}
  }
}

int main()
{
  count();
  cout << "noPrimes = " << noPrimes << endl;
  cout << "sum = " << sum << endl;
  return 0;
}