b = list(map(int,input().split(' '))) for i in range(9): if b[i] != i+1: print(i+1) exit(0) print(10)