class Solution: def solve(self , a ): # write code here seed = 0 for i in a: if seed != a[-1]: if i == seed: seed +=1 else: return i-1 else: return seed +1