N = int(eval(input()))

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



ans = 0

plus = ""

for i in range(N):

  if plus != "":

    if plus:

      if A[i-1] > A[i]:

        ans += 1

        plus = ""

    else:

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

        ans += 1

        plus = ""

  if i < N-1 and plus == "":

    if A[i] < A[i+1]:

      plus = True

    elif A[i] > A[i+1]:

      plus = False

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

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



before = a[0]

ok = "" #増加ならTrue

cnt = 0

for i in range(1,n):

  if ok == "":

    if before < a[i]:

      ok = True

    elif before > a[i]:

      ok = False

  elif ok:

    if before > a[i]:

      cnt += 1

      ok = ""

  elif not ok:

    if before < a[i]:

      cnt += 1

      ok = ""

  before = a[i]

print((cnt+1))
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
plus = ""
for i in range(N):
    if plus != "":
        if plus:
            if A[i - 1] > A[i]:
                ans += 1
                plus = ""
        else:
            if A[i - 1] < A[i]:
                ans += 1
                plus = ""
    if i < N - 1 and plus == "":
        if A[i] < A[i + 1]:
            plus = True
        elif A[i] > A[i + 1]:
            plus = False
print((ans + 1))

n = int(eval(input()))
a = list(map(int, input().split()))
before = a[0]
ok = ""  # 増加ならTrue
cnt = 0
for i in range(1, n):
    if ok == "":
        if before < a[i]:
            ok = True
        elif before > a[i]:
            ok = False
    elif ok:
        if before > a[i]:
            cnt += 1
            ok = ""
    elif not ok:
        if before < a[i]:
            cnt += 1
            ok = ""
    before = a[i]
print((cnt + 1))

-N = int(eval(input())) -A = list(map(int, input().split())) -ans = 0 -plus = "" -for i in range(N): -    if plus != "": -        if plus: -            if A[i - 1] > A[i]: -                ans += 1 -                plus = "" -        else: -            if A[i - 1] < A[i]: -                ans += 1 -                plus = "" -    if i < N - 1 and plus == "": -        if A[i] < A[i + 1]: -            plus = True -        elif A[i] > A[i + 1]: -            plus = False -print((ans + 1)) +n = int(eval(input())) +a = list(map(int, input().split())) +before = a[0] +ok = ""  # 増加ならTrue +cnt = 0 +for i in range(1, n): +    if ok == "": +        if before < a[i]: +            ok = True +        elif before > a[i]: +            ok = False +    elif ok: +        if before > a[i]: +            cnt += 1 +            ok = "" +    elif not ok: +        if before < a[i]: +            cnt += 1 +            ok = "" +    before = a[i] +print((cnt + 1))