P1368

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll p;
	while(cin>>p){
		cout<<p-p/2-p/5-p/11-p/13+p/10+p/22+p/26+p/55+p/65+p/143-p/110-p/130-p/286-p/715+p/1430<<endl;
	}
	return 0;
}

P1369

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll p[35],cnt=0;
ll ans=0;
ll x,xx;
void dfs(ll add,ll h,ll num){
	if(h==cnt+1){
		if(add%2==1) ans-=x/num;
		else ans+=x/num;
	}
	else{
		dfs(add,h+1,num);
		dfs(add+1,h+1,num*p[h]);
	}
}
int main(){
	cin>>x;
	xx=x;
	for(ll i=2;i<=sqrt(xx);i++){
		if(xx%i==0){
			p[++cnt]=i;
			while(xx%i==0) xx/=i;
		}
	}
	if(xx!=1) p[++cnt]=xx;
	dfs(0,1,1);
	cout<<ans;
	return 0;
}