#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, a[N], b[N], c[N];
long long ans;
int BS(int st, int fi, int tmp) {
  if (st + 1 == fi) return st;
  int mid = (st + fi) / 2;
  if (c[mid] <= tmp) return BS(mid, fi, tmp);
  return BS(st, mid, tmp);
}
int main() {
  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];
  c[n] = 1e9;
  sort(c, c + n);
  for (int i = 0; i < n; i++) {
    int j = BS(i, n + 1, -c[i]) + 1;
    ans += n - j;
  }
  cout << ans << endl;
}
