Bn = list(map(int,input().split())) L = range(1,10) i = 0 while Bn[i] == L[i]: i += 1 print(L[i])