#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	long long a[100010],b[100010],c[100010],tmp[100010],jwb=0;
	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); sort(b, b+n); sort(c, c+n);
	int j=0;
	for (int i=0;i<n;++i) {
		while (j<n && c[j]<=b[i]) ++j;
		tmp[i] = n-j;
	}
	tmp[n] = 0;
	for (int i=n-1;i>=0;--i) {
		tmp[i] += tmp[i+1];
	}
	j = 0;
	for (int i=0;i<n;++i) {
		while (j<n && b[j]<=a[i]) ++j;
		jwb += tmp[j];
	}
	cout << jwb << endl;
	return 0;
}