#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int n,ans;
bool aa(int x){
for(int i = 2; i <= sqrt(x); i ++)
if(x%i==0) return 1;
return 0;
}
int main(){
cin>>n;
for(int i = 4; i <= n; i ++){
if(aa(i))
ans+=i;
}
cout<<ans;
}