#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;
    lb=B*B;
    lc=C*C;
    ld=D*D;
    le=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;
    if (lc==le)
    {
        if (la+lb<=le) cout<<3;

    }

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

        }
    }

    return 0;
}
