import sys

input = sys.stdin.readline

a = list(map(int, input().rstrip().split(' ')))

 

for i in range(len(a)):

  if a[i] == 0:

    print((i+1))

    break

import sys

input = sys.stdin.readline



a = list(map(int, input().split(' ')))

 

for i in range(len(a)):

  if a[i] == 0:

    print((i+1))

    break

import sys

input = sys.stdin.readline
a = list(map(int, input().rstrip().split(" ")))
for i in range(len(a)):
    if a[i] == 0:
        print((i + 1))
        break

import sys

input = sys.stdin.readline
a = list(map(int, input().split(" ")))
for i in range(len(a)):
    if a[i] == 0:
        print((i + 1))
        break

-a = list(map(int, input().rstrip().split(" "))) +a = list(map(int, input().split(" ")))