N = int(eval(input()))

A = list(map(int,input().split()))

ans = 1

t = 0



for k in range(1,N):

    if A[k-1] > A[k]:

        t = -1

        break

    elif A[k-1] < A[k]:

        t = 1

        break

if t==0:

    print((1))

    exit(0)



k = 0

while k < N-1:

    k += 1

    if t == 1:

        if A[k-1] > A[k]:

            ans += 1

            while k+1<N and A[k]==A[k+1]:

                k += 1

            if k == N-1:

                break

            elif A[k] > A[k+1]:

                t = -1

            else:

                t = 1

    else:

        if A[k-1] < A[k]:

            ans += 1

            while k+1<N and A[k]==A[k+1]:

                k += 1

            if k == N-1:

                break

            elif A[k] > A[k+1]:

                t = -1

            else:

                t = 1



print(ans)
N = int(eval(input()))

A = list(map(int,input().split()))

A = A

f = 0

ans = 1

for k in range(N-1):

    if f == 0:

        if A[k] > A[k+1]:

            f = -1

        elif A[k] < A[k+1]:

            f = 1

    elif f == 1:

        if A[k] > A[k+1]:

            ans += 1

            f = 0

    else:

        if A[k] < A[k+1]:

            ans += 1

            f = 0

print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
t = 0
for k in range(1, N):
    if A[k - 1] > A[k]:
        t = -1
        break
    elif A[k - 1] < A[k]:
        t = 1
        break
if t == 0:
    print((1))
    exit(0)
k = 0
while k < N - 1:
    k += 1
    if t == 1:
        if A[k - 1] > A[k]:
            ans += 1
            while k + 1 < N and A[k] == A[k + 1]:
                k += 1
            if k == N - 1:
                break
            elif A[k] > A[k + 1]:
                t = -1
            else:
                t = 1
    else:
        if A[k - 1] < A[k]:
            ans += 1
            while k + 1 < N and A[k] == A[k + 1]:
                k += 1
            if k == N - 1:
                break
            elif A[k] > A[k + 1]:
                t = -1
            else:
                t = 1
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
A = A
f = 0
ans = 1
for k in range(N - 1):
    if f == 0:
        if A[k] > A[k + 1]:
            f = -1
        elif A[k] < A[k + 1]:
            f = 1
    elif f == 1:
        if A[k] > A[k + 1]:
            ans += 1
            f = 0
    else:
        if A[k] < A[k + 1]:
            ans += 1
            f = 0
print(ans)

+A = A +f = 0 -t = 0 -for k in range(1, N): -    if A[k - 1] > A[k]: -        t = -1 -        break -    elif A[k - 1] < A[k]: -        t = 1 -        break -if t == 0: -    print((1)) -    exit(0) -k = 0 -while k < N - 1: -    k += 1 -    if t == 1: -        if A[k - 1] > A[k]: +for k in range(N - 1): +    if f == 0: +        if A[k] > A[k + 1]: +            f = -1 +        elif A[k] < A[k + 1]: +            f = 1 +    elif f == 1: +        if A[k] > A[k + 1]: -            while k + 1 < N and A[k] == A[k + 1]: -                k += 1 -            if k == N - 1: -                break -            elif A[k] > A[k + 1]: -                t = -1 -            else: -                t = 1 +            f = 0 -        if A[k - 1] < A[k]: +        if A[k] < A[k + 1]: -            while k + 1 < N and A[k] == A[k + 1]: -                k += 1 -            if k == N - 1: -                break -            elif A[k] > A[k + 1]: -                t = -1 -            else: -                t = 1 +            f = 0