#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <fstream>
#include <typeinfo>
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define I insert
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define repi(i, a, b) for (ll i = a; i < b; i++)
#define repj(j, a, b) for (ll j = a; j < b; j++)
#define vi vector<int>
#define pii pair<int, int>
#define vpii vector<pii>
#define mod 1000000007
#define lim 100001

using namespace std;
ll factorial(ll n) { return (n == 1 || n == 0) ? 1 : n * factorial(n - 1); }
int max3(int a, int b, int c) { return max(a, max(c, b)); }
int gcd(int a, int b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
ll power(ll a, ll n)
{
    if (n == 1)
        return a;
    else if (n == 0)
        return 1;
    else
    {
        ll r = power(a, n / 2);
        if (n % 2 == 0)
            return r * r;
        else
            return r * a * r;
    }
}
ll nCr(ll n, ll r) { return ((factorial(n)) / (factorial(n - r) * factorial(r))); }
void dfs(vector<vector<int>> &v, vi &check, int start)
{
    check[start - 1] = 1;
    repj(j, 0, v[start - 1].size())
    {
        if (!check[v[start - 1][j] - 1])
        {
            dfs(v, check, v[start - 1][j]);
        }
    }
}
bool isPrime(ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
}
//works under 2 till 1e12
/*
ll printDivisors(ll n)
{
    // Note that this loop runs till square root
    ll count = 0;
    for (int i = 1; i <= sqrt(n); i++)
    {
        if (n % i == 0)
        {
            // If divisors are equal, print only one
            if (n / i == i){
                if(i%2==0)
                    count++;
            }

            else{
                if(i%2==0)
                    count++;
                if((n/i)%2==0)
                    count++;

            } // Otherwise print both
               
        }
    }
    return count;
}

// Initializing the roots of the array and the size of the roots

void initialize(int Arr[], int N, int Size[])
{
    for (int i = 0; i < N; i++)
    {
        Arr[i] = i;
        Size[i] = 1;
    }
}

// To find the root of any single element

int root(int Arr[], int i)
{
    while (Arr[i] != i)
    {
        i = Arr[i];
    }
    return i;
}

// To connect the roots of union elemnts

void Union(int Arr[], int A, int B, int Size[])
{
    int root_A = root(Arr, A);
    int root_B = root(Arr, B);
    if(root_A!=root_B){
        if (Size[root_B] > Size[root_A])
        {
            Arr[root_A] = root_B;
            Size[root_B] += Size[root_A];
        }
        else
        {
            Arr[root_B] = root_A;
            Size[root_A] += Size[root_B];
        }
    }
}

// To check the connectivity of two elements

bool Find(int Arr[], int A, int B)
{
    if (root(Arr, A) == root(Arr, B))
        return true;
    else
        return false;
}*/

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    for (int i = 0; i < 5;i++){
        int num;
        cin >> num;
        if(num==0){
            t = i + 1;
        }
    }
    cout << t;
    return 0;
}

Measured memory_bytes: 3656