triplets-1

Given three sorted arrays P, Q, and R of size X, Y and Z respectively. Find total number of triplets (P[i],Q[j],R[k]) such that P[i] ≤ Q[j] ≤ R[k] where 1 ≤ i ≤ X, 1 ≤ j ≤ Y and 1 ≤ k ≤ Z.
Input

First line contains integer X. Next line contains X integers separated by space denoting array P.

Next line contains integer Y. Next line contains Y integers separated by space denoting array Q.

Nexy line contains integer Z. Next line contains Z integers separated by space denoting array R.
Constraints

1 ≤ X, Y, Z ≤ 10^5

-10^9 ≤ elements of array ≤ 10^9

SAMPLE INPUT
3
1 5 7
2
9 10
2
5 11

SAMPLE OUTPUT
6

Source: hackerearth | Difficulty: EASY


Solutions: