1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
n = int(input())
a = list(map(int,input().split()))
b = [i for i in a]
ans1 = 0
ans2 = 0

for i in range(1,n):
	if i%2 == 0 and a[i]>=a[i-1]:
		ans1 += 1
		a[i] = -10000000
	elif i%2 == 1 and a[i]<=a[i-1]:
		ans1 += 1
		a[i] =  10000000
	
for i in range(1,n):
	if i%2 == 0 and b[i]<=b[i-1]:
		ans2 += 1
		b[i] =  10000000
	elif i%2 == 1 and b[i]>=b[i-1]:
		ans2 += 1
		b[i] = -10000000

print(min(ans1,ans2))