N = int(eval(input()))

A = [int(_) for _ in input().split()]



def solve(N, A):

    if N <= 2:

        return 1

    s = 0

    result = 1

    i = 0

    while i < N-1:

        r = A[i+1] - A[i]

        if (r > 0 and s < 0) or (r < 0 and s > 0):

            result += 1

            s = 0

        elif r != 0:

            s = r

        i += 1

    return result



print((solve(N, A)))

N = int(eval(input()))

A = [int(_) for _ in input().split()]



def solve(N, A):

    s = 0

    result = 1

    for i in range(N-1):

        r = A[i+1] - A[i]

        if r * s < 0:

            result += 1

            s = 0

        elif r != 0:

            s = r

    return result



print((solve(N, A)))

N = int(eval(input()))
A = [int(_) for _ in input().split()]


def solve(N, A):
    if N <= 2:
        return 1
    s = 0
    result = 1
    i = 0
    while i < N - 1:
        r = A[i + 1] - A[i]
        if (r > 0 and s < 0) or (r < 0 and s > 0):
            result += 1
            s = 0
        elif r != 0:
            s = r
        i += 1
    return result


print((solve(N, A)))

N = int(eval(input()))
A = [int(_) for _ in input().split()]


def solve(N, A):
    s = 0
    result = 1
    for i in range(N - 1):
        r = A[i + 1] - A[i]
        if r * s < 0:
            result += 1
            s = 0
        elif r != 0:
            s = r
    return result


print((solve(N, A)))

-    if N <= 2: -        return 1 -    i = 0 -    while i < N - 1: +    for i in range(N - 1): -        if (r > 0 and s < 0) or (r < 0 and s > 0): +        if r * s < 0: -        i += 1