N = int(eval(input()))

A = [int(x) for x in input().split()]

B = [int(x) for x in input().split()]

C = [int(x) for x in input().split()]



import bisect as bs

import numpy as np

A.sort()

C.sort()

#B_a:b未満のAのパーツ数、B_c:b超のCのパーツ数

B_a = np.array([bs.bisect_left(A,b) for b in B]) 

B_c = np.array([N-bs.bisect_right(C,b) for b in B])

ans = np.dot(B_a, B_c)

print(ans)
import bisect as bs



def main():

    with open(0) as f:

        N = int(f.readline())

        A = sorted(list(map(int, f.readline().split())))

        B = list(map(int, f.readline().split()))

        C = sorted(list(map(int, f.readline().split())))



    ans = 0

    for b in B:

        ans += bs.bisect_left(A, b) * (N-bs.bisect_right(C, b))

    print(ans)



main()
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
import bisect as bs
import numpy as np

A.sort()
C.sort()
# B_a:b未満のAのパーツ数、B_c:b超のCのパーツ数
B_a = np.array([bs.bisect_left(A, b) for b in B])
B_c = np.array([N - bs.bisect_right(C, b) for b in B])
ans = np.dot(B_a, B_c)
print(ans)

import bisect as bs


def main():
    with open(0) as f:
        N = int(f.readline())
        A = sorted(list(map(int, f.readline().split())))
        B = list(map(int, f.readline().split()))
        C = sorted(list(map(int, f.readline().split())))
    ans = 0
    for b in B:
        ans += bs.bisect_left(A, b) * (N - bs.bisect_right(C, b))
    print(ans)


main()

-N = int(eval(input())) -A = [int(x) for x in input().split()] -B = [int(x) for x in input().split()] -C = [int(x) for x in input().split()] -import numpy as np -A.sort() -C.sort() -# B_a:b未満のAのパーツ数、B_c:b超のCのパーツ数 -B_a = np.array([bs.bisect_left(A, b) for b in B]) -B_c = np.array([N - bs.bisect_right(C, b) for b in B]) -ans = np.dot(B_a, B_c) -print(ans) + +def main(): +    with open(0) as f: +        N = int(f.readline()) +        A = sorted(list(map(int, f.readline().split()))) +        B = list(map(int, f.readline().split())) +        C = sorted(list(map(int, f.readline().split()))) +    ans = 0 +    for b in B: +        ans += bs.bisect_left(A, b) * (N - bs.bisect_right(C, b)) +    print(ans) + + +main()