#include<iostream>
using namespace std;

int main()
{
    int A, B, C, D, E;
    int As, Bs, Cs, Ds, Es;
    int sumABCD,sumABC,sumAB, sumBCD, sumBC, sumCD;
    cin>>A;
    cin>>B;
    cin>>C;
    cin>>D;
    cin>>E;
    As=A*A;
    Bs=B*B;
    Cs=C*C;
    Ds=D*D;
    Es=E*E;
    sumABCD=As+Bs+Cs+Ds;
    sumABC=As+Bs+Cs;
    sumAB=As+Bs;
    sumBCD=Bs+Cs+Ds;
    sumBC=Bs+Cs;
    sumCD=Cs+Ds;
    if(Es-sumABCD>=0)
    {
        cout<<"1";
    }
    else
    {
        if(Es-sumABC>=0)
        {
            cout<<"2";
        }
        else
        {
            if(Es-sumAB>=0)
            {
                if(Es-sumAB-Cs>=Ds||Es-sumAB-Ds>=Cs)
                {
                    cout<<"2";
                }
                else
                {
                    cout<<"3";
                }
            }
            else
            {
                cout<<"4";
                if(Es-sumBCD>=0)
                {
                    cout<<"2";
                    if(Es-sumBC>=0)
                    {
                        if(Es-sumBC-As>=Ds || Es-sumBC-Ds>=As)
                        {
                            cout<<"2";
                        }
                        else
                        {
                            cout<<"3";
                        }
                    }
                        cout<<"4";
                        if(Es-sumCD>=0)
                        {
                            if(Es-sumCD-As>=Bs|| Es-sumCD-Bs>=As)
                            {
                                cout<<"2";
                            }
                            else
                            {
                                cout<<"3";
                            }
                        }
                    }
                    else
                    {
                        cout<<"4";
                    }
                }
            }
        }
    return 0;
}
