N = int(eval(input()))

A = sorted(list({int(eval(input())):i for i in range(N)}.items()),key=lambda x:x[0])

cnt = 0

for i in range(N):

    j = A[i][1]

    if i%2!=j%2:

        cnt += 1

print((cnt//2))
N = int(eval(input()))

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

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

A = sorted(A,key=lambda x:x[0])

cnt = 0

for i in range(N):

    a,j = A[i]

    if (i-j)%2==1:

        cnt += 1

print((cnt//2))
N = int(eval(input()))
A = sorted(list({int(eval(input())): i for i in range(N)}.items()), key=lambda x: x[0])
cnt = 0
for i in range(N):
    j = A[i][1]
    if i % 2 != j % 2:
        cnt += 1
print((cnt // 2))

N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
A = [(A[i], i) for i in range(N)]
A = sorted(A, key=lambda x: x[0])
cnt = 0
for i in range(N):
    a, j = A[i]
    if (i - j) % 2 == 1:
        cnt += 1
print((cnt // 2))

-A = sorted(list({int(eval(input())): i for i in range(N)}.items()), key=lambda x: x[0]) +A = [int(eval(input())) for _ in range(N)] +A = [(A[i], i) for i in range(N)] +A = sorted(A, key=lambda x: x[0]) -    j = A[i][1] -    if i % 2 != j % 2: +    a, j = A[i] +    if (i - j) % 2 == 1: