n = int(eval(input()))

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



if n <= 2:

    print((1))

    exit()



dec, inc = False, False

cnt = 1



for i in range(n-1):

    if a[i+1] - a[i] < 0:

        dec = True

    elif a[i+1] - a[i] > 0:

        inc = True



    if dec and inc:

        cnt += 1

        dec, inc = False, False



print(cnt)
n = int(eval(input()))

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



ans = 1

up = None



for x, y in zip(a, a[1:]):

    if x < y:

        if up is None:

            up = True

        elif not up:

            ans += 1

            up = None

    elif x > y:

        if up is None:

            up = False

        elif up:

            ans += 1

            up = None

print(ans)
n = int(eval(input()))
a = list(map(int, input().split()))
if n <= 2:
    print((1))
    exit()
dec, inc = False, False
cnt = 1
for i in range(n - 1):
    if a[i + 1] - a[i] < 0:
        dec = True
    elif a[i + 1] - a[i] > 0:
        inc = True
    if dec and inc:
        cnt += 1
        dec, inc = False, False
print(cnt)

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
up = None
for x, y in zip(a, a[1:]):
    if x < y:
        if up is None:
            up = True
        elif not up:
            ans += 1
            up = None
    elif x > y:
        if up is None:
            up = False
        elif up:
            ans += 1
            up = None
print(ans)

-if n <= 2: -    print((1)) -    exit() -dec, inc = False, False -cnt = 1 -for i in range(n - 1): -    if a[i + 1] - a[i] < 0: -        dec = True -    elif a[i + 1] - a[i] > 0: -        inc = True -    if dec and inc: -        cnt += 1 -        dec, inc = False, False -print(cnt) +ans = 1 +up = None +for x, y in zip(a, a[1:]): +    if x < y: +        if up is None: +            up = True +        elif not up: +            ans += 1 +            up = None +    elif x > y: +        if up is None: +            up = False +        elif up: +            ans += 1 +            up = None +print(ans)