import sys input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) sa = [(a[i], i) for i in range(N)] sa.sort(reverse = True) _, i = sa.pop() res = set() while len(sa): _, j = sa.pop() if i > j: res.add(i - j) i = j print(len(res))