import numpy as np

N=int(eval(input()))

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

B=list(np.argsort(np.array(A)))

X=[[0,0],[0,0]]

for i in range(N):

    X[i%2][B[i]%2]+=1

print((X[0][1]))

N=int(eval(input()))

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

AT=[(A[i],i) for i in range(N)]

AT.sort()

B=[AT[i][1] for i in range(N)]

X=[[0,0],[0,0]]

for i in range(N):

    X[i%2][B[i]%2]+=1

Y=[X[0][1],X[1][0]]

print((min(Y)))

import numpy as np

N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
B = list(np.argsort(np.array(A)))
X = [[0, 0], [0, 0]]
for i in range(N):
    X[i % 2][B[i] % 2] += 1
print((X[0][1]))

N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
AT = [(A[i], i) for i in range(N)]
AT.sort()
B = [AT[i][1] for i in range(N)]
X = [[0, 0], [0, 0]]
for i in range(N):
    X[i % 2][B[i] % 2] += 1
Y = [X[0][1], X[1][0]]
print((min(Y)))

-import numpy as np - -B = list(np.argsort(np.array(A))) +AT = [(A[i], i) for i in range(N)] +AT.sort() +B = [AT[i][1] for i in range(N)] -print((X[0][1])) +Y = [X[0][1], X[1][0]] +print((min(Y)))