#include <bits/stdc++.h>
using namespace std;
int V[200001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, num, p, q, cont;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> V[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> num;
    V[i] -= num;
  }
  sort(V, V + n, greater<long long>());
  p = 0;
  q = n - 1;
  cont = 0;
  while (p != q) {
    if (V[p] + V[q] > 0) {
      cont += (q - p);
      p++;
    } else {
      q--;
    }
  }
  cout << cont << endl;
}
