#include <iostream>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include<vector>
#include<random>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using lli = long long int;
int main(){
    lli n;
    cin>>n;
    ll ans=0;
    if(n>=1000) ans+=n-999;
    if (n>=1000000) ans+=n-999999;
    if (n>=1000000000) ans+=n-999999999;
    if (n>=1000000000000) ans+=n-999999999999;
    if (n>=1000000000000000) ans+=n-999999999999999;
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }
const ll inf = 1e10;
ll powx(ll a, ll b){
    ll ret = 1;
    FOR(i, b){
        if (ret > inf / a)
            return inf+1;
        ret *= a;
    }
    return ret;
}

int main(int argc, char** argv) {
    //ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    ll n;
    cin >> n;

    set<ll> S;
    for(int b=2; b<=60; b++){
        ll a = 2;
        while(1){
            ll ab = powx(a, b);
            if (ab <= n)
                S.insert(ab);
            else
                break;
            a++;
        }
    }
    cout << n-S.size() << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

