1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
n = int(input().strip())
seq = [int(x) for x in input().strip().split()]
seq2 = seq.copy()
A = 0
B = 0
for i in range(1,n):
    if i%2 == 0 and seq[i] >= seq[i-1]:
        A+=1
        seq[i] = -1000000000
    elif i%2 == 1 and seq[i] <= seq[i-1]:
        A+=1
        seq[i] = 1000000000
    if i%2 == 1 and seq2[i] >= seq2[i-1]:
        B+=1
        seq2[i] = -1000000000
    if i%2 == 0 and seq2[i] <= seq2[i-1]:
        B+=1
        seq2[i] = 1000000000


print(min(A,B))

#print(n)
#print(seq)