n = int(input()) r = list(map(int,input().split())) g = list(map(int,input().split())) b = list(map(int,input().split())) rls = [0] * 3001 gls = [0] * 3001 bls = [0] * 3001 for i in r: rls[i] += 1 for i in g: gls[i] += 1 for i in b: bls[i] += 1 c = 0 for i in range(1, 3001): for j in range(1, i+1): for k in range(max(1, i-j), i+1): c += rls[i] * gls[j] * bls[k] print(c)