N = int(eval(input()))

A = [int(eval(input())) for _ in range(N)]



D = {a:i for i,a in enumerate(sorted(A))}



A = [D[A[i]] for i in range(N)]



odd = [A[i] for i in range(N) if i%2 == 0]

even = [A[i] for i in range(N) if i%2 == 1]



odd.sort()

even.sort()



B = []



for i in range(N):

    if i%2 == 0:

        B.append(odd[i//2])

    else:

        B.append(even[i//2])



count = 0



for i in range(N):

    if i%2 == 0 and B[i]%2 != 0:

        count += 1



print(count)
N = int(eval(input()))

A = [int(eval(input())) for _ in range(N)]



D = {a:i for i,a in enumerate(sorted(A))}



A = [D[A[i]] for i in range(N)]



count = 0



for i in range(N):

    if i%2 == 0 and A[i]%2 != 0:

        count += 1



print(count)
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
D = {a: i for i, a in enumerate(sorted(A))}
A = [D[A[i]] for i in range(N)]
odd = [A[i] for i in range(N) if i % 2 == 0]
even = [A[i] for i in range(N) if i % 2 == 1]
odd.sort()
even.sort()
B = []
for i in range(N):
    if i % 2 == 0:
        B.append(odd[i // 2])
    else:
        B.append(even[i // 2])
count = 0
for i in range(N):
    if i % 2 == 0 and B[i] % 2 != 0:
        count += 1
print(count)

N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
D = {a: i for i, a in enumerate(sorted(A))}
A = [D[A[i]] for i in range(N)]
count = 0
for i in range(N):
    if i % 2 == 0 and A[i] % 2 != 0:
        count += 1
print(count)

-odd = [A[i] for i in range(N) if i % 2 == 0] -even = [A[i] for i in range(N) if i % 2 == 1] -odd.sort() -even.sort() -B = [] -for i in range(N): -    if i % 2 == 0: -        B.append(odd[i // 2]) -    else: -        B.append(even[i // 2]) -    if i % 2 == 0 and B[i] % 2 != 0: +    if i % 2 == 0 and A[i] % 2 != 0: