#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ll n;
    while (cin >> n) {
        ll l = 2, r = 2e9;
        while (l <= r) {
            ll mid = l + r >> 1;
            if (mid * (mid + 1) / 2 <= n + 1)
                l = mid + 1;
            else
                r = mid - 1;
        }
        cout << n - l + 2 << '\n';
    }
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define LL long long int
int main()
{
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    LL N;
    cin >> N;
    LL ans=0;
    map<LL,LL> hash;
    for(LL i=2 ; i <=(100000) ; i++)
    {
        LL temp = i*i ;
        while(temp <= N)
        {
            if(hash[temp]==false)
            {
                ans++;
            }
            hash[temp]=true;
            temp= temp*i;
        }
    }
    cout<< N-ans << endl;
}
