/*                ___
   _______________| |_
  /\                  \
 /  \                  \
/____\__________________\
|    |                  |
|    | Date : 26/07/2025|
|    | Author : pppssslc|
|____|__________________|
*/
#include<bits/stdc++.h>

using namespace std;

typedef string str;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> vll;
typedef map<int, int> mpii;
typedef map<ll, ll> mpll;
typedef set<int> si;
typedef set<ll> sl;
typedef complex<double> cd;
#define prio_que priority_queue

#define se second
#define fi first
#define For(i, l, r, x) for(int i = l; i <= r; i += x)
#define Ford(i, l, r, x) for(int i = l; i >= r; i -= x)
#define Fore(x, a) for(auto x: a)
#define pb push_back
#define ins insert
#define all(a) a.begin(), a.end()

#define phongdeptrainhatquadat main()

const ll inf = 1e18 + 1;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 1;
const int offset = 5e4 + 1;
const db PI = acos(-1);

void fft(vector<cd> &a, bool inv){
	int n = a.size();
	if(n <= 1) return;
	int j = 0;
	For(i, 1, n, 1){
		int bit = n >> 1;
		for(; j&bit; bit >>= 1) j ^= bit;
		j ^= bit;
		if(i < j) swap(a[i], a[j]);
	}
	For(len, 2, n, len){
		db ang = 2 * PI / len * (inv ? -1 : 1);
		cd wlen(cos(ang), sin(ang));
		For(i, 0, n - 1, len){
			cd w(1);
			For(j, 0, len / 2 - 1, 1){
				cd u = a[i + j];
				cd v = a[i + j + len / 2] * w;
				a[i + j] = u + v;
				a[i + j + len / 2] = u - v;
				w *= wlen;
			}
		}
	}
	if(inv) for(cd &x: a) x /= n;
}

int phongdeptrainhatquadat{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n; cin >> n;
	int maxA = 0, maxB = 0;
	vi cntA(maxn, 0), cntB(maxn, 0);
	For(i, 1, n, 1){
		int v; cin >> v;
		++cntA[v + offset], maxA = max(maxA, v);
	}
	For(i, 1, n, 1){
		int v; cin >> v;
		++cntB[v + offset], maxB = max(maxB, v);
	}
	int N = 1;
	while(N <= 2 * maxn) N <<= 1;
	vector<cd> polyA(N), polyB(N);
	For(i, 0, maxn, 1) polyA[i] = cntA[i];
	For(i, 0, maxn, 1) polyB[i] = cntB[i];
	fft(polyA, false); fft(polyB, false);
	vector<cd> polyR(N);
	For(i, 0, N, 1) polyR[i] = polyA[i] * polyB[i];
	fft(polyR, true);
	vl cnt(N);
	For(i, 0, N - 1, 1) cnt[i] = round(polyR[i].real());
	ll res = 0;
	For(i, 1, n, 1){
		int v; cin >> v; int s = v + 2 * offset;
		if(s < N) res += cnt[s];
	}
	cout << res;
	return (0 ^ 0);
}