#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin >> N;
  set<long long> st;
  for (long long i = 2; i * i <= N; i++){
    long long c = i;
    while (true){
      c *= i;
      if (c > N){
        break;
      }
      st.insert(c);
    }
  }
  cout << N - st.size() << endl;
}
#include<bits/stdc++.h>
#include<iostream>
#include<set>
#include<map>
#include<iterator>
#define ll              long long
#define lli             long long int
#define pb              push_back
#define mp              make_pair
#define RIP(i,n)        for(int i=0; i<n; i++)
#define F(i,a,b)        for(int i=a; i<b; i++)
#define RIP1(i,n)       for(int i=n-1; i>=0; i--)
#define FOR(i,a,b)      for(int i=a;i<(b); i++)
#define FOR1(i,a,b)     for(int i=a; i>=(b); i--)
#define sc(a)           scanf("%lld",&a)
#define SC(a)           scanf("%d",&a)
#define cin(a)          cin >> a
#define cout(a)         cout << a
#define pi              acos(-1)
#define pr(a)           printf("%lld\n",a)
#define PR(a)           printf("%lld ",a)
#define s(a,b)          sort(a,b)
#define sz(x)           (int)(x).size()
#define nl              '\n'
#define Max             10000000000
#define mod             1e9+7
using namespace std;
void F_I_O()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int main()
{
    ll n;
    cin >> n;
    ll ans=0;
    ll cnt=0;
    map<ll,ll>m;
    //set<ll>s;
   for(ll i=2; i*i<=n; i++)
    {
        ll r = sqrt(i);
        if(r*r!=i)
        {
            for(ll j=i*i; j<=n; j = j*i)
            {
                if(m[j]==0)
                {
                    ans++;
                    m[j]=1;
                }
            }
        }
    }
   /* for(ll i=2; i*i<=n; i++)
    {
        ll r = sqrt(i);
        if(r*r!=i)
        {
            double e = double(n);
            double f = double(i);
            ll p = (double)log(e)/(double)log(f);
            p++;
            ll g = pow(i,p);
            cout << p << ' ' << g << nl;
            if(g<=n)
            {
                ans+=(p-1);
            }
            else
            {
                ans+=(p-2);
            }
        }
    }*/
   n-=ans;
    cout << n<< nl;
}
