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