N = int(eval(input()))

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



ans = 1



#state0は未定、1は広義単調増加、2は広義単調減少

state = 0

m = A[0]



i = 1

while i <= N-1:

    if m < A[i]:

        if state == 0:

            state = 1

        elif state == 2:

            ans += 1

            state = 0

    elif m > A[i]:

        if state == 0:

            state = 2

        elif state == 1:

            ans += 1

            state = 0

    m = A[i]

    i += 1



print(ans)

N = int(eval(input()))

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

#state0は未定、1は広義単調増加、2は広義単調減少

state = 0

m = A[0]

ans = 1



for i in range(1,N):

    if m < A[i]:

        if state == 0:

            state = 1

        elif state == 2:

            ans += 1

            state = 0

    elif m > A[i]:

        if state == 0:

            state = 2

        elif state == 1:

            ans += 1

            state = 0

    m = A[i]



print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
# state0は未定、1は広義単調増加、2は広義単調減少
state = 0
m = A[0]
i = 1
while i <= N - 1:
    if m < A[i]:
        if state == 0:
            state = 1
        elif state == 2:
            ans += 1
            state = 0
    elif m > A[i]:
        if state == 0:
            state = 2
        elif state == 1:
            ans += 1
            state = 0
    m = A[i]
    i += 1
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
# state0は未定、1は広義単調増加、2は広義単調減少
state = 0
m = A[0]
ans = 1
for i in range(1, N):
    if m < A[i]:
        if state == 0:
            state = 1
        elif state == 2:
            ans += 1
            state = 0
    elif m > A[i]:
        if state == 0:
            state = 2
        elif state == 1:
            ans += 1
            state = 0
    m = A[i]
print(ans)

-ans = 1 -i = 1 -while i <= N - 1: +ans = 1 +for i in range(1, N): -    i += 1