N = int(input()) line = list(map(int, input().split(' '))) result = N num = N for i in range(N): if num == line[N-i]: result -= 1 num -= 1 print(result)