#include <iostream>
using namespace std;
int main()
{
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if(a+b+c+d<=e){
        cout << "1\n";
    } else {
        if(a+b+c<=e || a+b+d<=e || b+c+d<=e){
            cout << "2\n";
        } else {
            if(a+b<=e){
                if(c+d>e){
                    cout << "3\n";
                } else cout << "2\n";
            } else if(a+c<=e){
                if(b+d>e){
                    cout << "3\n";
                } else cout << "2\n";
            } else if(a+d){
                if(c+b>e){
                    cout << "3\n";
                } else cout << "2\n";
            } else if(b+c<=e){
                if(a+d>e){
                    cout << "3\n";
                } else cout << "2\n";
            } else if(b+d<=e){
                if(c+d>e){
                    cout << "3\n";
                } else cout << "2\n";
            } else if(c+d<=e){
                if(a+b>e){
                    cout << "3\n";
                } else cout << "2\n";
            }
        }
        if(a==e){
            cout << "4\n";
        } else if(b==e){
            cout << "4\n";
        } else if(c==e){
            if(a+b>e){
                cout << "4\n";
            } else {
                cout << "3\n";
            }
        }
    }
    return 0;
}