#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using Graph = vector<vector<int>>;
const int INF = 1001001001;
void printVec(vector<int> &vec) {
  for (auto itr = vec.begin(); itr != vec.end(); itr++) cout << *itr << " "; 
  cout << endl;
}

int main() {
  ll N;
  cin >> N;
  vector<ll> vec;
  for(ll i = 2; i <= 100001; i++) {
    for(ll j = 2; j <= 35; j++) {
      ll a = pow(i, j);
      if(a > N) break;
      vec.push_back(a);
    }
  }
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  cout << N - vec.size() << endl;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  long long n; cin >> n;
  map<long long,bool> m;
  long long ans = n;
  for (long long i = 2; i * i <= n; i++) {
    if (m.count(i)) continue;
    long long t = i * i;
    while (t <= n) {
      ans--;
      m[t] = true;
      t *= i;
    }
  }
  cout << ans << '\n';
}
