#include <bits/stdc++.h>
using namespace std;
bool ib = ios_base::sync_with_stdio(0);
bool it = cin.tie(0);
bool ot = cout.tie(0);
int main() {
  int n;
  cin >> n;
  int a[n], b[n], c[n];
  long long res = 0;
  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 = 0; i < n; i++) {
    if (c[i] <= 0) continue;
    int j = lower_bound(c, c + n, -c[i] + 1) - c;
    res += (i - j);
  }
  cout << res;
  return 0;
}
