#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int b[n];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  int c[n];
  for (int i = 0; i < n; i++) {
    c[i] = a[i] - b[i];
  }
  sort(c, c + n);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (c[i] <= 0) {
      continue;
    }
    int pos = lower_bound(c, c + n, -c[i] + 1) - c;
    ans += i - pos;
  }
  cout << ans << "\n";
}
