#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n], b[n], c[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (long long i = 0; i < n; i++) {
    c[i] = b[i] - a[i];
  }
  sort(c, c + n);
  long long x = 0, e = n - 1, s = 0;
  while (x < e) {
    if (c[x] + c[e] < 0) {
      s += (e - x);
      x++;
    } else {
      e--;
    }
  }
  cout << s << endl;
  return 0;
}
