include[HTML_REMOVED]
include[HTML_REMOVED]
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int n;
int a[N],b[N],c[N];
int search_a(int k){ //二分统计a中比b[i]小的元素
int l = 0,r = n - 1;
while(l < r){
int mid = l + r + 1 >> 1;
if(a[mid] < k) l = mid;
else r = mid - 1;
}
return l + 1;
}
int search_c(int k ){ //二分统计c中比b[i]大的元素
int l = 0,r = n - 1;
while(l < r){
int mid = l + r >> 1;
if(c[mid] > k) r = mid;
else l = mid + 1;
}
return n - l;
}
int main(){
cin >> n;
for(int i = 0; i < n; i ) cin >> a[i];
for(int i = 0; i < n; i ) cin >> b[i];
for(int i = 0; i < n; i ) cin >> c[i];
sort(a,a + n); //对a排序
sort(c,c + n); //对c排序
LL res = 0;
for(int i = 0; i < n; i ){
if(a[0] >= b[i] || c[n - 1] <= b[i]) continue; //注意:需要特判当a全部大于b[i]的情况和c全部小于b[i]的情况
res += (LL)search_a(b[i]) * search_c(b[i]);
}
cout << res << endl;
return 0;
}