#include<iostream>
#include<cmath>
using namespace std;
int main()
{
long long k ;
int len;
cin>>k;
//k = 1000000;
len = pow(k, 0.2);
k = k - pow(len, 5);
cout<<k<<endl<<endl;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNtYXRoPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpCnsKICAgIGxvbmcgbG9uZyBrIDsKICAgIGludCBsZW47CiAgICBjaW4+Pms7CiAgICAvL2sgPSAxMDAwMDAwOwogICAgbGVuID0gcG93KGssIDAuMik7CiAgICBrID0gayAtIHBvdyhsZW4sIDUpOwogICAgY291dDw8azw8ZW5kbDw8ZW5kbDsKfQo=