#include <bits/stdc++.h>
using namespace std;
int a[2 * 100001], b[2 * 100001], c[2 * 100001];
int main() {
  int n, tem;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    c[i] = a[i] - b[i];
  }
  sort(c + 1, c + n + 1);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int l = i + 1, r = n, m, aa = n + 1;
    while (l <= r) {
      m = (l + r) >> 1;
      if (c[i] + c[m] > 0) {
        r = m - 1;
        aa = m;
      } else {
        l = m + 1;
      }
    }
    ans = ans + n - aa + 1;
  }
  cout << ans << endl;
  return 0;
}
