x = input().split(" ") f = 0 for i in range(9): if str(i+1) == x[i]: pass else: print(i+1) f = 1 break if f == 1: pass else: print("10")