#include <bits/stdc++.h>
using namespace std;
bool isPowerOfTwo(long long x) { return x && (!(x & (x - 1))); }
bool SameSign(long long x, long long y) { return (x >= 0) ^ (y < 0); }
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long b[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  long long good = 0;
  vector<int> c(n);
  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) continue;
    int pos = lower_bound(c.begin(), c.end(), -c[i] + 1) - c.begin();
    ans += i - pos;
  }
  cout << ans << endl;
  return 0;
}
