#include <bits/stdc++.h>
using namespace std;
const int mxn = 200007;
int n, c1, c2, a[mxn], b[mxn], morea[mxn], moreb[mxn];
long long ans;
inline int read(int out = 0) {
  char c;
  while ((c = getchar()) < 48 || c > 57)
    ;
  while (c >= 48 && c <= 57) out = out * 10 + c - 48, c = getchar();
  return out;
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 1; i <= n; ++i) {
    b[i] = read();
    if (a[i] > b[i])
      morea[++c1] = a[i] - b[i];
    else
      moreb[++c2] = a[i] - b[i];
  }
  ans += (long long)c1 * (c1 - 1) / 2;
  sort(moreb + 1, moreb + c2 + 1);
  int l, r, mid;
  for (int i = 1; i <= c1; ++i) {
    l = 1, r = c2;
    while (l <= r) {
      mid = l + r >> 1;
      if (morea[i] + moreb[mid] > 0)
        r = mid - 1;
      else
        l = mid + 1;
    }
    ans += (c2 - l + 1);
  }
  cout << ans;
  return 0;
}
