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