n=int(eval(input()))

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

ans,c,d=0,1,True

while c<n:

    if a[c]==a[c-1]:

        c+=1

        continue

    if d:

        f=a[c]>a[c-1]

        d=False

    elif f:

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

            ans+=1

            d=True

    else:

        if a[c]>a[c-1]:

            ans+=1

            d=True

    c+=1

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

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

ans=1

d=0

for i in range(1,n):

    diff=a[i]-a[i-1]

    if d==0:

        d=diff

    elif d*diff<0:

        d=0

        ans+=1

print(ans)
n = int(eval(input()))
a = list(map(int, input().split()))
ans, c, d = 0, 1, True
while c < n:
    if a[c] == a[c - 1]:
        c += 1
        continue
    if d:
        f = a[c] > a[c - 1]
        d = False
    elif f:
        if a[c] < a[c - 1]:
            ans += 1
            d = True
    else:
        if a[c] > a[c - 1]:
            ans += 1
            d = True
    c += 1
print((ans + 1))

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
d = 0
for i in range(1, n):
    diff = a[i] - a[i - 1]
    if d == 0:
        d = diff
    elif d * diff < 0:
        d = 0
        ans += 1
print(ans)

-ans, c, d = 0, 1, True -while c < n: -    if a[c] == a[c - 1]: -        c += 1 -        continue -    if d: -        f = a[c] > a[c - 1] -        d = False -    elif f: -        if a[c] < a[c - 1]: -            ans += 1 -            d = True -    else: -        if a[c] > a[c - 1]: -            ans += 1 -            d = True -    c += 1 -print((ans + 1)) +ans = 1 +d = 0 +for i in range(1, n): +    diff = a[i] - a[i - 1] +    if d == 0: +        d = diff +    elif d * diff < 0: +        d = 0 +        ans += 1 +print(ans)