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