#include <bits/stdc++.h>
#define endl "\n"
#define rep(i, n) for(int i = 0; i < int(n); i++)
#define rep2(i, s, n) for(int i = (s); i < int(n); i++)
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ipair;
typedef pair<ll, ll> lpair;
template <class T> ostream &operator << (ostream &o, const vector<T> &v) //vectorの中身を見る
{o << "{"; for(int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", ":"") << v[i]; o << "}"; return o;}
void map_p(map<int, int> &d){cout << "map: "; for(auto a : d){cout << "{" << a.first << ":" << a.second << "}, ";} cout << endl;} //mapの中身を見る
void set_p(set<int> &d){cout << "set: "; for(int a : d){cout << a << ", ";} cout << endl;} //setの中身を見る


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    ll n, cnt = 0;
    cin >> n;
    ll max_ = pow(10, 5) + 3;
    set<ll> kinds;
    rep2(i, 2, max_){
        ll now = i;
        while(true){
            now *= i;
            if(n < now) break;
            if(kinds.find(now) == kinds.end()){ // a^b = c^dのこともある
                cnt++;
                kinds.insert(now);
            }
        }
    }
    cout << n - cnt << endl;
    return 0;
}
#include<cstdio>
#include<iostream>
#include<cmath>
#define ll long long
using namespace std;
int main()
{
	ll n;
	scanf("%lld",&n);
	for(ll i = 1; i<=sqrt(n); i++)
	{
		if(n%i==0)
		cout<<i<<endl;
	}
	for(ll i = sqrt(n); i>=1; i--)
	{
		if(i*i!=n)
		 if(n%i==0)
	    	cout<<n/i<<endl;
	}
 } 