#include <iostream>
using namespace std;

int main () {
    int a, b, c, d, e, x;
    cin >> a >> b >> c >> d >> e;
    a = a * a * a;
    b = b * b * b;
    c = c * c * c;
    d = d * d * d;
    e = e * e * e;
    x = a + b + c + d;
    if (e >= x){
        cout << 1;
        return 0;
    }
    if (e >= a + b && e >= c + d || e >= a + c && e >= b + d || e >= a + d && e >= b + c){
        cout << 2;
        return 0;
    }
    if (e >= a + b + c || e >= a + b + d || e >= a + c + d || e > b + c + d){
        cout << 3;
        return 0;
    }
    cout << 4;


    return 0;
}
