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