#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<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] = a[i] - b[i];
  }
  sort(c.begin(), c.end());
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (c[i] > 0) {
      ans = ans +
            (i - (lower_bound(c.begin(), c.end(), -1 * c[i] + 1) - c.begin()));
    }
  }
  cout << ans << '\n';
}
