n = eval(input())

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



b = []

for i in range(1, n):

    if a[i] - a[i-1] != 0:

        b.append(a[i] - a[i-1])

dont_mind = True

c = 1

i = 1

while i < len(b):

    prev = b[i-1]

    t = prev * b[i]

    if t >= 0:

        i += 1

        continue

    if t < 0:

        c += 1

        i += 2

        continue

    i += 1

print(c)
# coding: utf-8

# AGC 013 a 

# Here your code !

n = eval(input())

if n <= 2:

    print(1)

    exit()

    

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



c = 1



status = "n"

i = 1

while i < n:

    if status == "n":

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

            status = "i"

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

            status = "d"

        i += 1

        

    elif status == "i":

        if a[i-1] <= a[i]:

            i += 1

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

            status = "n"

            c += 1

            i += 1

        

    elif status == "d":

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

            status = "n"

            c += 1

            i += 1

        elif a[i-1] >= a[i]:

            i += 1

print(c)
n = eval(input())
a = list(map(int, input().split()))
b = []
for i in range(1, n):
    if a[i] - a[i - 1] != 0:
        b.append(a[i] - a[i - 1])
dont_mind = True
c = 1
i = 1
while i < len(b):
    prev = b[i - 1]
    t = prev * b[i]
    if t >= 0:
        i += 1
        continue
    if t < 0:
        c += 1
        i += 2
        continue
    i += 1
print(c)

# coding: utf-8
# AGC 013 a
# Here your code !
n = eval(input())
if n <= 2:
    print(1)
    exit()
a = list(map(int, input().split()))
c = 1
status = "n"
i = 1
while i < n:
    if status == "n":
        if a[i - 1] < a[i]:
            status = "i"
        elif a[i - 1] > a[i]:
            status = "d"
        i += 1
    elif status == "i":
        if a[i - 1] <= a[i]:
            i += 1
        elif a[i - 1] > a[i]:
            status = "n"
            c += 1
            i += 1
    elif status == "d":
        if a[i - 1] < a[i]:
            status = "n"
            c += 1
            i += 1
        elif a[i - 1] >= a[i]:
            i += 1
print(c)

+# coding: utf-8 +# AGC 013 a +# Here your code ! +if n <= 2: +    print(1) +    exit() -b = [] -for i in range(1, n): -    if a[i] - a[i - 1] != 0: -        b.append(a[i] - a[i - 1]) -dont_mind = True +status = "n" -while i < len(b): -    prev = b[i - 1] -    t = prev * b[i] -    if t >= 0: +while i < n: +    if status == "n": +        if a[i - 1] < a[i]: +            status = "i" +        elif a[i - 1] > a[i]: +            status = "d" -        continue -    if t < 0: -        c += 1 -        i += 2 -        continue -    i += 1 +    elif status == "i": +        if a[i - 1] <= a[i]: +            i += 1 +        elif a[i - 1] > a[i]: +            status = "n" +            c += 1 +            i += 1 +    elif status == "d": +        if a[i - 1] < a[i]: +            status = "n" +            c += 1 +            i += 1 +        elif a[i - 1] >= a[i]: +            i += 1