import numpy as np

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



def main():

    N = int(readline())

    A = [int(i) for i in readline().split()]

    B = [int(i) for i in readline().split()]

    C = [int(i) for i in readline().split()]



    A = np.array(sorted(A), dtype=np.int64)

    B = np.array(sorted(B), dtype=np.int64)

    C = np.array(sorted(C), dtype=np.int64)



    A_bisect = np.searchsorted(A, B, side="left")

    C_bisect = np.searchsorted(C, B, side="right")



    ans = A_bisect * (N - C_bisect)

    print((ans.sum()))





if __name__ == "__main__":

    main()

import numpy as np

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



def main():

    N = int(readline())

    A = np.array(readline().split(), dtype=np.int64)

    B = np.array(readline().split(), dtype=np.int64)

    C = np.array(readline().split(), dtype=np.int64)



    A.sort()

    B.sort()

    C.sort()



    A_bisect = np.searchsorted(A, B, side="left")

    C_bisect = np.searchsorted(C, B, side="right")



    ans = A_bisect * (N - C_bisect)

    print((ans.sum()))





if __name__ == "__main__":

    main()

import numpy as np
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N = int(readline())
    A = [int(i) for i in readline().split()]
    B = [int(i) for i in readline().split()]
    C = [int(i) for i in readline().split()]
    A = np.array(sorted(A), dtype=np.int64)
    B = np.array(sorted(B), dtype=np.int64)
    C = np.array(sorted(C), dtype=np.int64)
    A_bisect = np.searchsorted(A, B, side="left")
    C_bisect = np.searchsorted(C, B, side="right")
    ans = A_bisect * (N - C_bisect)
    print((ans.sum()))


if __name__ == "__main__":
    main()

import numpy as np
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N = int(readline())
    A = np.array(readline().split(), dtype=np.int64)
    B = np.array(readline().split(), dtype=np.int64)
    C = np.array(readline().split(), dtype=np.int64)
    A.sort()
    B.sort()
    C.sort()
    A_bisect = np.searchsorted(A, B, side="left")
    C_bisect = np.searchsorted(C, B, side="right")
    ans = A_bisect * (N - C_bisect)
    print((ans.sum()))


if __name__ == "__main__":
    main()

-    A = [int(i) for i in readline().split()] -    B = [int(i) for i in readline().split()] -    C = [int(i) for i in readline().split()] -    A = np.array(sorted(A), dtype=np.int64) -    B = np.array(sorted(B), dtype=np.int64) -    C = np.array(sorted(C), dtype=np.int64) +    A = np.array(readline().split(), dtype=np.int64) +    B = np.array(readline().split(), dtype=np.int64) +    C = np.array(readline().split(), dtype=np.int64) +    A.sort() +    B.sort() +    C.sort()