#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
void solve() {
  long long n, m, i, j, k = 0, l;
  cin >> n;
  long long a[n + 10], b[n + 10];
  vector<long> v;
  vector<pair<long long, long long> > pg;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (i = 0; i < n; i++) {
    pg.push_back(make_pair(a[i], b[i]));
    v.push_back(a[i] - b[i]);
  }
  sort(v.begin(), v.end());
  for (i = 0; i < n; i++) {
    if (v[i] > 0) {
      k += (n - 1 - i);
    } else if (v[i] <= 0) {
      k += v.end() - upper_bound(v.begin(), v.end(), (-v[i]));
    }
  }
  cout << k << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) solve();
  return 0;
}
