N = int(eval(input()))

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



First = True

ans = 1

status = None

for i in range(1, N):

    if First:

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

            status = "up"

            First = False

            continue

        elif A[i-1] > A[i]:

            status = "down"

            First = False

            continue



    if (status == "up") & (A[i-1] > A[i]):

        ans += 1

        First = True

        continue



    if (status == "down") & (A[i-1] < A[i]):

        ans += 1

        First = True

        continue



print(ans)









N = int(eval(input()))

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



ans = 1

status = "Unset"

for i in range(1, N):

    if status == "Unset":

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

            status = "UP"

        elif A[i-1] > A[i]:

            status = "DOWN"



    else:

        if status == "UP" and A[i-1] > A[i]:

            ans += 1

            status = "Unset"



        if status == "DOWN" and A[i-1] < A[i]:

            ans += 1

            status = "Unset"



print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
First = True
ans = 1
status = None
for i in range(1, N):
    if First:
        if A[i - 1] < A[i]:
            status = "up"
            First = False
            continue
        elif A[i - 1] > A[i]:
            status = "down"
            First = False
            continue
    if (status == "up") & (A[i - 1] > A[i]):
        ans += 1
        First = True
        continue
    if (status == "down") & (A[i - 1] < A[i]):
        ans += 1
        First = True
        continue
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
status = "Unset"
for i in range(1, N):
    if status == "Unset":
        if A[i - 1] < A[i]:
            status = "UP"
        elif A[i - 1] > A[i]:
            status = "DOWN"
    else:
        if status == "UP" and A[i - 1] > A[i]:
            ans += 1
            status = "Unset"
        if status == "DOWN" and A[i - 1] < A[i]:
            ans += 1
            status = "Unset"
print(ans)

-First = True -status = None +status = "Unset" -    if First: +    if status == "Unset": -            status = "up" -            First = False -            continue +            status = "UP" -            status = "down" -            First = False -            continue -    if (status == "up") & (A[i - 1] > A[i]): -        ans += 1 -        First = True -        continue -    if (status == "down") & (A[i - 1] < A[i]): -        ans += 1 -        First = True -        continue +            status = "DOWN" +    else: +        if status == "UP" and A[i - 1] > A[i]: +            ans += 1 +            status = "Unset" +        if status == "DOWN" and A[i - 1] < A[i]: +            ans += 1 +            status = "Unset"