print(sum(a[1]%2for a in sorted((eval(input()),i)for i in range(eval(input())))[::2]))
n,*a=list(map(int,open(0)))

print((len({*a[::2]}^{*sorted(a)[::2]})//2))
print(
    sum(a[1] % 2 for a in sorted((eval(input()), i) for i in range(eval(input())))[::2])
)

n, *a = list(map(int, open(0)))
print((len({*a[::2]} ^ {*sorted(a)[::2]}) // 2))

-print( -    sum(a[1] % 2 for a in sorted((eval(input()), i) for i in range(eval(input())))[::2]) -) +n, *a = list(map(int, open(0))) +print((len({*a[::2]} ^ {*sorted(a)[::2]}) // 2))