import numpy as np



N = int(eval(input()))

A = list(map(int, input().split()))

B = list(map(int, input().split()))

C = list(map(int, input().split()))



An = np.array(A)

Bn = np.array(B)

Cn = np.array(C)



An.sort()

Bn.sort()

Cn = -Cn

Cn.sort()



AB = np.searchsorted(An,Bn,side='left')

CB = np.searchsorted(Cn,-Bn,side='left')



print(((AB*CB).sum()))
import bisect



N = int(eval(input()))

A = list(map(int, input().split()))

B = list(map(int, input().split()))

C = list(map(int, input().split()))



A.sort()

B.sort()

C.sort()

c_len = len(C)



cnt = 0

for b in B:

    a_cnt = bisect.bisect_left(A,b)

    c_cnt = c_len - bisect.bisect_right(C,b)

    cnt +=  a_cnt * c_cnt



print(cnt)
import numpy as np

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
An = np.array(A)
Bn = np.array(B)
Cn = np.array(C)
An.sort()
Bn.sort()
Cn = -Cn
Cn.sort()
AB = np.searchsorted(An, Bn, side="left")
CB = np.searchsorted(Cn, -Bn, side="left")
print(((AB * CB).sum()))

import bisect

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
c_len = len(C)
cnt = 0
for b in B:
    a_cnt = bisect.bisect_left(A, b)
    c_cnt = c_len - bisect.bisect_right(C, b)
    cnt += a_cnt * c_cnt
print(cnt)

-import numpy as np +import bisect -An = np.array(A) -Bn = np.array(B) -Cn = np.array(C) -An.sort() -Bn.sort() -Cn = -Cn -Cn.sort() -AB = np.searchsorted(An, Bn, side="left") -CB = np.searchsorted(Cn, -Bn, side="left") -print(((AB * CB).sum())) +A.sort() +B.sort() +C.sort() +c_len = len(C) +cnt = 0 +for b in B: +    a_cnt = bisect.bisect_left(A, b) +    c_cnt = c_len - bisect.bisect_right(C, b) +    cnt += a_cnt * c_cnt +print(cnt)