b=list(map(int,input().split())) count=0 for i in b: count +=1 if count+1==i: print(count) break