#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E16;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Add(long long &pos, long long val) { pos = mod(pos + val); }
long double EPS = 1E-9;
template <class T>
bool Max(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool Min(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n], b[n], c[n];
  for (long long i = 0; i <= n - 1; i++) cin >> a[i];
  for (long long i = 0; i <= n - 1; i++) cin >> b[i];
  for (long long i = 0; i <= n - 1; i++) c[i] = a[i] - b[i];
  sort(c, c + n);
  long long ans = 0;
  for (long long i = n - 1; i >= 0; i--) {
    ans += c + i - upper_bound(c, c + i, -c[i]);
  }
  cout << ans << "\n";
  return 0;
}
