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