n = int(eval(input()))

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



count = 0

sign = 0

num = 0

ans = 0

for i, ai in enumerate(a):

    if count == 0:

        num = ai

        sign = 0

        count += 1

    elif count == 1:

        if ai > num:

            sign = 1

        elif ai < num:

            sign = -1

        else:

            sign = 0

        count += 1

        num = ai

    else:

        if sign == 0:

            if ai > num:

                sign = 1

            elif ai < num:

                sign = -1

            else:

                sign = 0

            count += 1

            num = ai

        elif sign > 0:

            if ai < num:

                num = ai

                count = 1

                sign = 0

                ans += 1

            else:

                num = ai

        else:

            if ai > num:

                num = ai

                count = 1

                sign = 0

                ans += 1

            else:

                num = ai



if count > 0:

    ans += 1



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

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



ans = 1

up = None

for l, r in zip(a, a[1:]):

    if l == r:

        continue

    if l < r:

        if up is None:

            up = True

        elif not up:

            ans += 1

            up = None

    else:

        if up is None:

            up = False

        elif up:

            ans += 1

            up = None



print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
sign = 0
num = 0
ans = 0
for i, ai in enumerate(a):
    if count == 0:
        num = ai
        sign = 0
        count += 1
    elif count == 1:
        if ai > num:
            sign = 1
        elif ai < num:
            sign = -1
        else:
            sign = 0
        count += 1
        num = ai
    else:
        if sign == 0:
            if ai > num:
                sign = 1
            elif ai < num:
                sign = -1
            else:
                sign = 0
            count += 1
            num = ai
        elif sign > 0:
            if ai < num:
                num = ai
                count = 1
                sign = 0
                ans += 1
            else:
                num = ai
        else:
            if ai > num:
                num = ai
                count = 1
                sign = 0
                ans += 1
            else:
                num = ai
if count > 0:
    ans += 1
print(ans)

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

-count = 0 -sign = 0 -num = 0 -ans = 0 -for i, ai in enumerate(a): -    if count == 0: -        num = ai -        sign = 0 -        count += 1 -    elif count == 1: -        if ai > num: -            sign = 1 -        elif ai < num: -            sign = -1 -        else: -            sign = 0 -        count += 1 -        num = ai +ans = 1 +up = None +for l, r in zip(a, a[1:]): +    if l == r: +        continue +    if l < r: +        if up is None: +            up = True +        elif not up: +            ans += 1 +            up = None -        if sign == 0: -            if ai > num: -                sign = 1 -            elif ai < num: -                sign = -1 -            else: -                sign = 0 -            count += 1 -            num = ai -        elif sign > 0: -            if ai < num: -                num = ai -                count = 1 -                sign = 0 -                ans += 1 -            else: -                num = ai -        else: -            if ai > num: -                num = ai -                count = 1 -                sign = 0 -                ans += 1 -            else: -                num = ai -if count > 0: -    ans += 1 +        if up is None: +            up = False +        elif up: +            ans += 1 +            up = None