import sys

N = int(sys.stdin.readline().rstrip())
numbers = [int(x) for x in sys.stdin.readline().split()]

start = 9
ans = 0

while True:
    correct = True

    for it in xrange(start - 9, start):
        if it > (N - 1) or it + 1 > (N - 1):
            print ans
            sys.exit(0)
        if numbers[it] >= numbers[it + 1]:
            correct = False

    for it in xrange(start, start + 9):
        if it > (N - 1) or it + 1 > (N - 1):
            print ans
            sys.exit(0)
        if numbers[it] <= numbers[it + 1]:
            correct = False

    if correct:
        ans += 1

    start += 1