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