from numpy import sign



n = int(eval(input()))

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

b = [sign(a[i+1]-a[i]) for i in range(n-1)]



c = 1

f = 0

for t in b:

  if f == 0:

    f = t

  elif f == 1 and t == -1:

    c += 1

    f = 0

  elif f == -1 and t == 1:

    c += 1

    f = 0

print(c)

    

  
from numpy import sign



n = int(eval(input()))

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

b = [sign(a[i+1]-a[i]) for i in range(n-1)]



c = 1

f = 0

for t in b:

  if f == 0:

    f = t

  elif f*t == -1:

    c += 1

    f = 0

print(c) 
from numpy import sign

n = int(eval(input()))
a = list(map(int, input().split()))
b = [sign(a[i + 1] - a[i]) for i in range(n - 1)]
c = 1
f = 0
for t in b:
    if f == 0:
        f = t
    elif f == 1 and t == -1:
        c += 1
        f = 0
    elif f == -1 and t == 1:
        c += 1
        f = 0
print(c)

from numpy import sign

n = int(eval(input()))
a = list(map(int, input().split()))
b = [sign(a[i + 1] - a[i]) for i in range(n - 1)]
c = 1
f = 0
for t in b:
    if f == 0:
        f = t
    elif f * t == -1:
        c += 1
        f = 0
print(c)

-    elif f == 1 and t == -1: -        c += 1 -        f = 0 -    elif f == -1 and t == 1: +    elif f * t == -1: