#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T re() {
  T N = 0;
  char c = getchar();
  bool neg = 0;
  for (; c < '0' || c > '9'; c = getchar()) neg |= c == '-';
  for (; c >= '0' && c <= '9'; c = getchar()) N = (N << 3) + (N << 1) + c - '0';
  return neg ? -N : N;
}
const int MX = 2e5;
int n;
int diff[MX + 5];
int main() {
  n = re<int>();
  for (int i = 1; i <= n; i++) diff[i] += re<int>();
  for (int i = 1; i <= n; i++) diff[i] -= re<int>();
  sort(diff + 1, diff + n + 1);
  int hi = n;
  diff[0] = -0x3f3f3f3f;
  long long tot = 0;
  for (int i = 1; i <= n; i++) {
    while (hi > i && diff[i] + diff[hi] > 0) hi--;
    tot += (n - max(hi, i));
  }
  printf("%lld\n", tot);
  return 0;
}
