#include <bits/stdc++.h>
using namespace std;
int a[200005], b[200005], d[200005];
int main() {
  int n;
  long long sum = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) d[i] = a[i] - b[i];
  sort(d + 1, d + 1 + n);
  for (int i = 1; i <= n; i++) {
    if (d[i] <= 0) {
      int pos = upper_bound(d + 1, d + 1 + n, -d[i]) - d;
      sum += n + 1 - pos;
    }
    if (d[i] > 0) {
      sum += n - i;
    }
  }
  cout << sum;
  return 0;
}
