//
//  main.cpp
//  compeitive_coding
//
//  Created by Ajay Chauhan
//  Copyright © 2020 Ajay Chauhan. All rights reserved.
//
//         **
//        *  *
//       *    *
//      *      *
//     *        *
//    ************
//   *            *
//  *              *
// *                *
//*                  *

#include<bits/stdc++.h>
#include <sys/time.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldo;
#define endl            "\n"
#define pi              3.1415926535897932384626433832795
#define mod             (ll)1000000007
#define pp              pair<ll,ll>
#define vii             vector<int>
#define vll             vector<ll>
#define vpp             vector<pp>
#define vss             vector<string>
#define pb              push_back
#define pob             pop_back
#define mp              make_pair
#define pf              push_front
#define pof             pop_front
#define eb              emplace_back
#define ff              first
#define ss              second
#define bs(v,x)         binary_search(v.begin(),v.end(),x)
#define ub(v,x)       upper_bound(v.begin(),v.end(),x)
#define lb(v,x)       lower_bound(v.begin(),v.end(),x)
#define print(A,n)      for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n)       for(ll i=0;i<n;++i)cin>>A[i];
#define set(x)          memset(x,0,sizeof(x));
#define Sort(x)         sort(x.begin(),x.end())
#define fast            ios_base::sync_with_stdio(false);cin.tie(NULL);
#define setd(s,s1,S1)   set_difference(s.begin(),s.end(),s1.begin(),s1.end(),inserter(S1,S1.end())); //set and multi set
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace(f) for(auto it=f.begin();it!=f.end();it++)cout<<*it<<" ";cout<<endl;

////cout << fixed << setprecision(n) << (double)103993/33102<<endl;
//
////ll n;  //size of string
////vll h,pw;     //1 indexing   // size==n+1
////ll p = 67;
////void hashing(string s) {
////
////    pw[0] = 1;
////    for(ll i=n-1;i>=0;i--) {
////        h[i] = (h[i+1]*p) % mod + (s[i]-'a'+1) % mod;
////        pw[n-i] = (pw[n-1-i]*p)%mod;
////    }
////    pw[n] = (pw[n-1]*p) % mod;
////}
////
////ll getH(ll l,ll r) {
////    return  (mod - (h[r+1]*pw[r-l+1])%mod + h[l]) % mod;
////}
//
//ll power(ll x, ll y, ll p)
//{
//    ll res = 1;     // Initialize result
//
//    x = x % p; // Update x if it is more than or
//                // equal to p
//
//    if (x == 0) return 0; // In case x is divisible by p;
//
//    while (y > 0)
//    {
//        // If y is odd, multiply x with result
//        if (y & 1)
//            res = (res*x) % p;
//
//        // y must be even now
//        y = y>>1; // y = y/2
//        x = (x*x) % p;
//    }
//    return res;
//}
//ll gcd(ll a,ll b){
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//bool isPrime(ll n)
//{
//    // Corner cases
//    if (n <= 1)  return false;
//    if (n <= 3)  return true;
//
//    // This is checked so that we can skip
//    // middle five numbers in below loop
//    if (n%2 == 0 || n%3 == 0) return false;
//
//    for (ll i=5; i*i<=n; i=i+6)
//        if (n%i == 0 || n%(i+2) == 0)
//           return false;
//
//    return true;
//}
////int parent[10001]={0};
////int score[10001]={0};
////int chef[10001]={0};
////void make_set(int x){
////    parent[x]=x;
////}
////int find_set(int x){
////    if(x==parent[x])
////        return x;
////    return parent[x]=find_set(parent[x]);
////}
////void union_sets(int a,int b){
////    int p=find_set(a);
////    int q=find_set(b);
////    if(p==q)
////        return;
////    if(score[p]==score[q])
////        return;
////    if(score[p]<score[q])
////        swap(p,q);
////
////    chef[q]=chef[p];
//////    score[p]=max(score[p],score[q]);
////    parent[q]=p;
////}
////
//
//vll get_prefix_array(string s){
//    ll n=s.size();
//    vll ans(n,0);
//    ll j=0,i=1;
//    while(i<n){
//        if(s[i]==s[j]){
//            ans[i]=j+1;
//            i++;
//            j++;
//        }
//        else{
//            if(j!=0){
//                j=ans[j-1];
//            }
//            else{
//                ans[i]=0;
//                i++;
//            }
//        }
//    }
//    return ans;
//}
//bool is_present(string text,string pattern){
//    ll p=text.size();
//    ll q=pattern.size();
//    vll temp=get_prefix_array(pattern);
//    ll i=0,j=0;
//    while(i<p && j<q){
//        if(text[i]==pattern[j]){
//            i++;
//            j++;
//        }
//        else{
//            if(j!=0)
//                j=temp[j-1];
//            else
//                i++;
//        }
//    }
//    if(j==q)
//        return true;
//    return false;
//}
//
//
//long double logn(long double a,long double n)
//{
//    return(log(n)/log(a));
//}
//
////ll dfs(ll st,ll parent,vector<vector<ll>>&g,vll& visited){
////    if(visited[st])
////        return 0;
////    visited[st]=1;
////    if(g[st].size()<=1){
////        return st+parent;
////    }
////    ll ret=0;
////    for(auto i:g[st]){
////        if(!visited[i]){
////            ret+=dfs(i,st,g,visited);
////        }
////    }
////    return ret;
////}
////void dfs(ll st,vector<vector<ll>>&g,vll& visited,vll& count){
////    if(visited[st])
////        return;
////    visited[st]=1;
////    if(g[st].size()==1)
////        count[st]=1;
////    for(auto i:g[st]){
////        if(!visited[i]){
////            count[st]+=count[i];
////            dfs(st,g,visited,count);
////        }
////    }
////}
////bool comp(pair<ll,ll>a,pair<ll,ll>b){
////    if(a.first==b.first)
////        return a.second>b.second;
////    return a.first<b.first;
////}
////#define MAXN   100001
////
////int spf[MAXN];
////
////void sieve()
////{
////    spf[1] = 1;
////    for (int i=2; i<MAXN; i++)
////
////        spf[i] = i;
////
////    for (int i=4; i<MAXN; i+=2)
////        spf[i] = 2;
////
////    for (int i=3; i*i<MAXN; i++)
////    {
////        if (spf[i] == i)
////        {
////            for (int j=i*i; j<MAXN; j+=i)
////
////                if (spf[j]==j)
////                    spf[j] = i;
////        }
////    }
////}
////
////
////void getFactorization(int x,multiset<int>&mlt)
////{
////    unordered_set<int> ret;
////    while (x != 1)
////    {
////        ret.insert(spf[x]);
////        x = x / spf[x];
////    }
////    for(auto i:ret)
////        mlt.insert(i);
////}
//bool isPowerOfTwo (ll x)
//{
//    /* First x in the below expression is for the case when x is 0 */
//    return x && (!(x&(x-1)));
//}
//ll parent[100001]={0};
//ll siz[100001]={0};
//void make_set(ll x){
//     parent[x]=x;
//     siz[x]=1;
// }
// ll find_set(ll x){
//     if(x==parent[x])
//         return x;
//     return parent[x]=find_set(parent[x]);
// }
// void union_sets(ll a,ll b){
//     ll p=find_set(a);
//     ll q=find_set(b);
//     if(p==q)
//         return;
//     if(siz[p]<siz[q])
//         swap(p,q);
//     parent[q]=p;
//     siz[p]+=siz[q];
// }
//ll power(ll x, ll y, ll p)
//{
//    ll res = 1;     // Initialize result
//
//    x = x % p; // Update x if it is more than or
//                // equal to p
//
//    if (x == 0) return 0; // In case x is divisible by p;
//
//    while (y > 0)
//    {
//        // If y is odd, multiply x with result
//        if (y & 1)
//            res = (res*x) % p;
//
//        // y must be even now
//        y = y>>1; // y = y/2
//        x = (x*x) % p;
//    }
//    return res;
//}

int main()
{
    fast;
    ll L=1;
//    cin>>L;
    while(L--){
        ll a,b,c,d,e;
        cin>>a>>b>>c>>d>>e;
        if(a==0)
            cout<<1<<endl;
        else if(b==0)
            cout<<2<<endl;
        else if(c==0)
            cout<<3<<endl;
        else if(d==0)
            cout<<4<<endl;
        else if(e==0)
            cout<<5<<endl;
    }
    return 0;
}


Measured memory_bytes: 3604