
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>


using namespace std;


int main() {

    long int N;

    cin >> N;

    set<long int> re;

    for (int b = 2; b < int(sqrt(N)) + 2; ++b) {
        for (int e = 2; e < 40; ++e) {
            long int v = static_cast<long int>(pow(b,e));
            if (v <= N && v > 0) re.insert(v);
            else break;
        } 
    }

    cout << N - re.size() << "\n";


}

#include <bits/stdc++.h> 

using namespace std; 

#define N 1000005 
#define MAX 1e18 
vector<long int> powers; 
set<long int> squares; 
set<long int> s; 

void powersPrecomputation() 
{ 
	for (long int i = 2; i < N; i++) 
	{ 
		squares.insert(i * i); 
		if (squares.find(i) != squares.end()) 
				continue; 

		long int temp = i; 
		while (i * i <= MAX / temp) 
		{ 
			temp *= (i * i); 
			s.insert(temp); 
		} 
	} 
	for (auto x : s) 
		powers.push_back(x); 
} 

long int calculateAnswer(long int R) 
{ 
	long int perfectSquares = floor(sqrtl(R));
	long int high = (upper_bound(powers.begin(), 
			powers.end(), R) - powers.begin()); 
	long int low = (lower_bound(powers.begin(), 
			powers.end(), 1) - powers.begin()); 
	perfectSquares += (high - low); 

	return perfectSquares; 
} 
int main() 
{ 
	powersPrecomputation(); 
	long int L{1}; 
	long int R;
	cin>>R;

	cout << R+1-calculateAnswer(R); 
	return 0; 
} 
