_,p=open(0)

m=10**18

c=0

for p in map(int,p.split()):

    c+=p<m

    m=min(m,p)

print(c)
_,p=open(0)

m=9e9

c=0

for p in map(int,p.split()):c+=p<m;m=min(m,p)

print(c)
_, p = open(0)
m = 10**18
c = 0
for p in map(int, p.split()):
    c += p < m
    m = min(m, p)
print(c)

_, p = open(0)
m = 9e9
c = 0
for p in map(int, p.split()):
    c += p < m
    m = min(m, p)
print(c)

-m = 10**18 +m = 9e9