N = int(eval(input()))

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

def solve(N,A):

    liss = []

    lis = []

    lis.append(A[0])

    a = A[0]

    for i in range(1,N):

        if len(lis)==1 or prev==0:

            prev = A[i]-a

        elif (A[i]-a)*prev<0:

            liss.append(lis)

            lis = []

        lis.append(A[i])

        a = A[i]

    liss.append(lis)

    ans = len(liss)

    return ans

print((solve(N,A)))
N = int(eval(input()))

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

def solve(N,A):

    ans = 1

    lis = []

    lis.append(A[0])

    a = A[0]

    for i in range(1,N):

        if len(lis)==1 or prev==0:

            prev = A[i]-a

        elif (A[i]-a)*prev<0:

            ans += 1

            lis = []

        lis.append(A[i])

        a = A[i]

    return ans

print((solve(N,A)))
N = int(eval(input()))
A = list(map(int, input().split()))


def solve(N, A):
    liss = []
    lis = []
    lis.append(A[0])
    a = A[0]
    for i in range(1, N):
        if len(lis) == 1 or prev == 0:
            prev = A[i] - a
        elif (A[i] - a) * prev < 0:
            liss.append(lis)
            lis = []
        lis.append(A[i])
        a = A[i]
    liss.append(lis)
    ans = len(liss)
    return ans


print((solve(N, A)))

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


def solve(N, A):
    ans = 1
    lis = []
    lis.append(A[0])
    a = A[0]
    for i in range(1, N):
        if len(lis) == 1 or prev == 0:
            prev = A[i] - a
        elif (A[i] - a) * prev < 0:
            ans += 1
            lis = []
        lis.append(A[i])
        a = A[i]
    return ans


print((solve(N, A)))

-    liss = [] +    ans = 1 -            liss.append(lis) +            ans += 1 -    liss.append(lis) -    ans = len(liss)