#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[n], res = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a[i] -= x;
  }
  sort(a, a + n);
  int pos = -1;
  for (int i = 0; i < n; i++)
    if (a[i] > 0) {
      pos = i;
      break;
    }
  if (pos != -1) {
    for (int i = pos; i < n; i++) res += a + i - upper_bound(a, a + i, -a[i]);
  }
  cout << res;
}
