lis=list(map(int,input().split())) for i in range(9): if i+1!=lis[i]: print(i+1) break