#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int arr1[n], arr2[n];
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> arr1[i];
  for (int i = 0; i < n; i++) cin >> arr2[i];
  for (int i = 0; i < n; i++) v[i] = arr1[i] - arr2[i];
  sort(v.begin(), v.end());
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] <= 0)
      continue;
    else {
      int pos = lower_bound(v.begin(), v.end(), -v[i] + 1) - v.begin();
      ans += i - pos;
    }
  }
  cout << ans;
  return 0;
}
