n = int(input()) a = list(map(int, input().split())) b = sorted(a) i = n - 1 for x in reversed(a): if x == b[i]: i -= 1 print(i + 1)