#include <iostream>
using namespace std;

int main()
{   int A,B,C,D,E,counter=0;
    cin >> A >> B >> C >> D >> E;
    if(E >= A+B+C+D)
    {
       counter=1;
    }
    if(E >= A+B+C and C==D)
    {
        counter=2;
    }
    if(E>=B+C+D and (D>A))
    {
      counter = 2;
    }
     if(E>=B+C+D and (C>A))
    {
      counter = 2;
    }
     if(E>=B+C+D and (B>A))
    {
      counter = 2;
    }
    if(A==B and B==C and C==D and D==E and A==C and A==D and A==E and B==D and B==E and C==E)
    {
        counter=4;
    }
    if(E >=C+D and D>=A+B)
    {
        counter=1;
    }
    if(E >= C+D and C>=A+B)
    {
        counter=1;
    }
    cout << counter;


    return 0;
}
