#include <iostream>
using namespace std;
int main ()
{
    int A,B,C,D,E,br=0,la,lb,lc,ld,le;
    cin>>A>>B>>C>>D>>E;
    la=A*A*A;
    lb=B*B*B;
    lc=C*C*C;
    ld=D*D*D;
    le=E*E*E;
    if (le-ld>1)
    {
        if (le-ld-lc>1)
        {
            if (le-ld-lc-lb>1)
            {
                if (le-ld-lc-lb-la>=1)
                {
                    cout<<1;
                }
            }
        }
    }

    if (la==le or lb==le) cout<<4;
    else
    {
        if (lc==le)
        {
            if (la+lb<=le) cout<<3;
            else cout<<4;
        }



    if (ld==le)
    {
        if (lc+lb+la<=le) cout<<2;
        else
        {
            if (lb+la<=le) cout<<3;
            else cout<<4;
        }
    }
    }
    return 0;
}
