#include <iostream>

using namespace std;

int main()
{
    int a,s,d,f,g,h,j,k,l,z;
    cin >> a >> s >> d >> f >> h >> j >> k >> l >> z;
    a=s=f=g=h=j=k=l=z=0;
    if (d==1)
        cout << "4" << endl;
    else
        cout << "3" <<endl;
    return 0;
}