#include <bits/stdc++.h>
using namespace std;
float PHI = 1.6180339;
const float PI_F = 3.14159265358979f;
long long modpow(long long x, long long n, long long m) {
  if (n == 0) return 1 % m;
  long long u = modpow(x, n / 2, m);
  u = (u * u) % m;
  if (n % 2 == 1) u = (u * x) % m;
  return u;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cout << fixed << setprecision(2);
  long long n;
  cin >> n;
  long long arr1[n + 10];
  long long arr2[n + 10];
  for (long long i = 0; i < n; i++) {
    cin >> arr1[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> arr2[i];
  }
  vector<long long> diff;
  set<long long> s;
  long long val = -1;
  for (long long i = 0; i < n; i++) {
    long long x = arr1[i] - arr2[i];
    diff.push_back(x);
    s.insert(x);
    val = x;
  }
  sort(diff.begin(), diff.end());
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    long long x = diff[i];
    if (x <= 0) continue;
    long long result =
        lower_bound(diff.begin(), diff.end(), -x + 1) - diff.begin();
    long long y = i - result;
    ans += y;
  }
  cout << ans << "\n";
  return 0;
}
