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

#define read(x)    freopen(x, "r", stdin);
#define write(x)   freopen(x, "w", stdout);



#define ll long long
#define lli long long int
#define ve vector<int>
#define FOR(n)          for(int i=0; i<(int)(n); ++i)
#define TEST_CASE(t)    for(int z=1;z<=t;z++)
#define PRINT_CASE      printf("Case %d: ",z)
#define pb push_back
#define mod 1000000007
#define maxx 200005

             //#define sazzad

int main()
{
    #ifdef sazzad
read("input.txt");
// write("output.txt");
#endif


      int r,g,b,ans,res;
      vector<int>v(4);
      FOR(4) scanf("%d",&v[i]);
      ans = *min_element(v.begin(),v.end());
      printf("%d\n",ans);






	return 0;
}

#include <iostream>
#include <math.h>
#include <unordered_set>
using namespace std;
int main(void)
{
    long long int N;
    cin >> N;
    long long int a, b;
    a = 2;
    b = 2;
    long long int count = 0;
    unordered_set<long long int> s;
    while (pow(a, b) <= N) {
        while (pow(a, b) <= N) {
            count++;
            s.insert(pow(a, b));
            b++;
        }
        b = 2;
        a++;
    }
    cout << N-s.size() << endl;
}