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