#include <bits/stdc++.h>

using namespace std;
#define ms(x,a) memset(x,a,sizeof x)
typedef long long ll;
const int mod=1e9+7, inf=0x3f3f3f3f, MAXN=0;

int main(){
    cin.tie(0)->sync_with_stdio(0);
    ll n; cin >> n;
    ll ans=n;
    for (ll i=2;i*i<=n;++i){
        bool flag=1;
        for (ll j=2;j*j<=i;++j){
            if (i%j) continue;
            ll tmp=i;
            while (tmp%j==0) tmp/=j;
            if (tmp==1) flag=0;
        }
        if (!flag) continue;
        ll tmp=i;
        while (tmp*i<=n){
            tmp*=i, ans--;
        }
    }
    cout << ans << '\n';
}
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long u64;
typedef pair<int,int> pii;
typedef vector<int> vi;
inline void read(int& x){
	static char c;
	while(!isdigit(c=getchar()));x=c^48;
	while(isdigit(c=getchar()))x=(x*10)+(c^48);
}
inline void read(ll& x){
	static char c;
	while(!isdigit(c=getchar()));x=c^48;
	while(isdigit(c=getchar()))x=(x*10)+(c^48);
}

const int N=1e5;
ll n;

int Prm[N+10],vis[N+10],Mu[N+10],tot;
inline void Euler(){
	Mu[1]=1;
	for(int i=2;i<=N;++i){
		if(!vis[i]) Prm[++tot]=i,Mu[i]=-1;
		for(int j=1;j<=tot&&i*Prm[j]<=N;++j){
			vis[i*Prm[j]]=1;
			if(i%Prm[j]==0) break;
			Mu[i*Prm[j]]=-Mu[i];
		}
	}
}

ll Ans;

inline void Work(){
	read(n),Euler();
	for(int i=2;;++i){
		ll sq=pow(n,1.0/i);
		ll l=1,r=sq+2,mid,ans=sq;
		while(l<=r){
			mid=l+r>>1;
			if(pow(mid,i)<=n) ans=mid,l=mid+1;
			else r=mid-1;
		}
		if(ans==1) break;
		Ans+=(ans-1)*Mu[i];
	}
	printf("%lld\n",n+Ans);
}

int main(){Work();}