#include<bits/stdc++.h>
using namespace std;
//increase stack size
#pragma comment(linker, "/STACK:16777216")
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define eb emplace_back
//#define mp make_pair
#define F first
#define S second
#define coutd(x) cout << fixed << setprecision(x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define newl2 cout<<'\n';
#define newl '\n'
#define sz(x)       (int)x.size()
#define clr(x) memset(x, 0, sizeof(x))
#define PI 3.1415926535897932384626
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<ll>      vl;
typedef vector<pii>     vpii;
typedef vector<pl>      vpl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}

string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}

template<typename T>
T toIntegralType(const string &str) {
    static_assert(is_integral<T>::value, "Integral type required.");
    T ret;
    stringstream ss(str);
    ss >> ret;
    if ( to_string(ret) != str)
        throw invalid_argument("Can't convert " + str);
    return ret;
} 

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}
bool sortbysecdesc(const pair<int,int> &a, 
                   const pair<int,int> &b) 
{ 
       return a.second>b.second; 
} 
ll fast_power(ll a,ll x)
{
    if(x==0) return 1;
    else if(x==1) return a;
    else { ll R = fast_power(a,x>>1);
    if(!(x&1)) return R*R;
    else return R*a*R; }
}
/*int psieve[1000005]={0};
void prime_sieve()
{
  //first mark all odd number prime
  for(int i=3;i<=1000000;i+=2)
  {
    psieve[i]=1;
  }

  //Sieve
  for(ll i=3;i<=1000000;i+=2)
  {
    // if the current number is not marked (it is prime)
    if(psieve[i]==1)
    {
      //mark all the multiples of i as not prime
      for(ll j=i*i; j<=1000000; j=j+i)
        psieve[j]=0;
    }
  }
  //special case
  psieve[2]=1;
  psieve[1]=psieve[0]=0;
}*/

/*bool cprime(int n)
{
    for(int i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            return false;
        }
    }
    return true;
}*/

/*
// Segment tree
const int maxN = 1e5 + 5;

int a[maxN], n, tree[4 * maxN];

void build(int left, int right, int node){
    if(left == right){
        tree[node] = a[left];
        return;
    }
    int mid = left + (right - left) / 2;
    build(left, mid, 2 * node);
    build(mid + 1, right, 2 * node + 1);
    tree[node] = max(tree[2 * node], tree[2 * node + 1]);
    return;
}
int query(int left, int right, int node, int l_idx, int r_idx){
    if(left > r_idx || right < l_idx){
        return 0;
    }
    if(l_idx <= left && r_idx >= right){
        return tree[node];
    }
    int mid = left + (right - left) / 2;
    int min1 = query(left, mid, 2 * node, l_idx, r_idx);
    int min2 = query(mid + 1, right, 2 * node + 1, l_idx, r_idx);
    return max(min1, min2);
}*/
void solve()
{
    int x;
    for(int i=1;i<=5;i++)
    {
        cin>>x; if(x==0){cout<<i; return;}
    }
    

}
int main()
{
   fio;
   // #ifndef ONLINE_JUDGE
   // freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
   //prime_sieve();
   srand(chrono::high_resolution_clock::now().time_since_epoch().count());
   int t=1;
  // cin>>t;
   while(t--)
   {
       solve();
   }
}  

Measured memory_bytes: 3588