#include <bits/stdc++.h>
using namespace std;
long long a[200001], b[200001], c[200001];
int main() {
  long long n, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) c[i] = a[i] - b[i];
  sort(c, c + n);
  for (int i = n - 1;; i--) {
    if (c[i] <= 0) break;
    int ans1 = &c[i] - upper_bound(c, c + n, 0 - c[i]);
    ans += ans1;
  }
  cout << ans << endl;
  return 0;
}
