#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <list>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
void ex_gcd(ll a,ll b, ll& d,ll& x,ll& y){
  if(!b) {d=a;x=1;y=0;}
  else   {	ex_gcd(b,a%b,d,y,x);	y-=a/b*x;}
}
ll inv(ll a,ll n)  {
  ll d,x,y;	ex_gcd(a,n,d,x,y);
  return d==1?(x%n+n)%(n/d):-1;
}
ll gcd(ll x, ll y){
  if(y==0)return x;
  return gcd(y, x%y);
}
const int maxn = 100005;
const int mod = 998244353;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  ll x;
  cin>>x;
  set<ll>st;
  for(int i=2;i*(ll)i<=x;i++){
    ll cur = i;
    for(;cur*i<=x;){
      cur*=i;
      st.insert(cur);
    }
  }
  cout<<x-st.size()<<endl;
  return 0;
}
#include <bits/stdc++.h>

using namespace std;
typedef long long int64;

int main()
{
    int64 n;
    set<int64> S;
    cin >> n;
    int64 j=0;
    for(int64 i=2;i<=100000;i++)
    {
        //printf("%lld\n",i);
        j = i;
        while(j<=10000000000)
        {
            j*=i;
            //printf("%lld\n",j);
            if(j<=10000000000)S.insert(j);
        }
    }
    /*
    for(int64 x:S)
    {
        cout << x << " ";
    }*/
    auto iter = upper_bound(S.begin(), S.end(), n);
    int idx = distance(S.begin(), iter);
    if(n<=3)cout << n;
    else cout << n-idx;
    //cout << lower_bound(S.begin(),S.end(),n);
}