n=list(map(int,input().split())) print([i+1 for i in range(9) if n[i]!=i+1][0])