#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ss second
#define ff first
#define all(a) a.begin(), a.end()
#define All(a) a.rbegin(), a.rend()
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.precision(10), cout << fixed
template <typename T>
T binpow(T base, T exp) {
    T result = 1;
    while (exp > 0) {
        if (exp & 1) result = (result * base);
        base = (base * base);
        exp >>= 1;
    }
    return result;
}
int main() {
    ios;
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ll n;
    cin >> n;
    ll counter = 0;
    map<ll, bool> mp;
    for (ll i = 2; i * i <= n; ++i) {
        ll x = i;
        for (ll j = 2;; ++j) {
            x *= i;
            if (x > n) break;
            if (mp.find(x) == mp.end()) {
                counter++;
                mp[x] = 1;
            }
        }
    }
    cout << n - counter << '\n';
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long n,num;
  cin >> n;

  if(n>=100000) num=100000;
  else num=n;

  set<long long> Set;
  long long tmp,ans=0;
  for(int i=2;i<num;i++){
    for(int j=2;j<34;j++){
      tmp = pow(i,j);
      if(tmp>n) break;
      Set.insert(tmp);
    }
  }

  cout << (n-Set.size()) << endl;
}
