#include<iostream>
using namespace std;
int main()
{
    int A,B,C,D,E,Efirstvalue,NumPackage=1;
    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;
    Efirstvalue=E*E*E;

        if (E>D)
        {
            E=E-D;
        }
        else
        {
            E=E+E;
            NumPackage+=1;
            if (E>D)
            {
                E=E-D;
            }
        }


        if (E>C)
        {
            E=E-C;
        }
        else
        {
            E=E+Efirstvalue;
            NumPackage+=1;
            if (E>C)
            {
                E=E-C;
            }
        }


        if (E>B)
        {
            E=E-B;
        }
        else
        {
            E=E+Efirstvalue;
            NumPackage+=1;
            if (E>B)
            {
                E=E-B;
            }
        }

        if (E>A)
        {

        }
        else
        {
            NumPackage+=1;
        }


    cout<<NumPackage;
    return 0;
}
