#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;
    }
    if (A == B == C == D == E)
    {
        cout<<4;
    }
    if ((A + B + C || A + B + D || A + C + D || B + C + D) <= E)
    {
        cout<<2;
    }
    if ((A + B || A + C || A + D || B + C || C + D) <= E)
    {
        cout<<3;
    }
    return 0;
}