from collections import Counter def main(): n = int(input()) R = list(map(int, input().split())) G = list(map(int, input().split())) B = list(map(int, input().split())) # R.sort() # G.sort() # B.sort() Rc = Counter(R) Gc = Counter(G) Bc = Counter(B) S = [0] * 10 ** 4 for r in Rc.keys(): S[r] += Rc[r] for i in range(len(S)): S[i] += S[i - 1] ans = 0 for g in Gc.keys(): for b in Bc.keys(): ans += Gc[g] * Bc[b] * (S[g + b - 1] - S[max(g, b) - 1]) print(ans) main()