#include <bits/stdc++.h>
using namespace std;
const int INF = 1e6;
const long long int mod = 998244353;
int main() {
  long long int n;
  cin >> n;
  long long int a[n], b[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; i++) cin >> b[i];
  vector<long long int> pos, neg;
  long long int zer = 0;
  for (long long int i = 0; i < n; i++) {
    if (a[i] - b[i] > 0)
      pos.push_back(a[i] - b[i]);
    else if (a[i] - b[i] < 0)
      neg.push_back(b[i] - a[i]);
    else
      zer++;
  }
  long long int q = pos.size();
  sort(pos.begin(), pos.end());
  long long int ans = 0;
  for (long long int i = 0; i < neg.size(); i++) {
    long long int av =
        upper_bound(pos.begin(), pos.end(), neg[i]) - pos.begin();
    av = pos.size() - av;
    ans += av;
  }
  ans = ans + (zer * q);
  ans = ans + (q * (q - 1) / 2);
  cout << ans;
}
