#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) { return a > b ? a : b; }
long long min(long long a, long long b) { return a < b ? a : b; }
double max(double a, double b) { return a > b ? a : b; }
double min(double a, double b) { return a < b ? a : b; }
long long modd(long long a) {
  if (a < 0LL) return a * -1LL;
  return a;
}
double modd(double a) {
  if (a < 0.0) return a * -1.0;
  return a;
}
long long modulo(long long a) { return a % 1000000007LL; }
long long power(long long k, long long p) {
  if (p == 0) return 1LL;
  long long P = power(k, p / 2LL);
  P = (P * P) % 1000000007LL;
  if (p % 2 == 1) P = (P * k) % 1000000007LL;
  return P;
}
long long q = 0;
long long cc = 0;
void _merge(char arr[], long long low, long long mid, long long high) {
  long long n = high - low + 1;
  char res[n];
  long long left = low;
  long long right = mid + 1;
  char ans;
  long long itr = 0;
  while (left <= mid && right <= high) {
    if (cc == q) {
      exit(0);
    }
    cout << "? " << arr[left] << " " << arr[right] << endl;
    fflush(stdout);
    cc++;
    cin >> ans;
    if (ans == '<') {
      res[itr++] = arr[left++];
    } else {
      res[itr++] = arr[right++];
    }
  }
  while (left <= mid) {
    res[itr++] = arr[left++];
  }
  while (right <= high) {
    res[itr++] = arr[right++];
  }
  for (long long i = 0; i < n; i++) {
    arr[i + low] = res[i];
  }
}
void _sort(char arr[], long long low, long long high) {
  if (low >= high) {
    return;
  }
  long long mid = (low + high) / 2;
  _sort(arr, low, mid);
  _sort(arr, mid + 1, high);
  _merge(arr, low, mid, high);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long b[n];
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
  }
  vector<long long> c(n);
  for (long long i = 0; i < n; i++) {
    c[i] = a[i] - b[i];
  }
  sort(c.begin(), c.end());
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (c[i] <= 0) {
      continue;
    }
    long long elem = (c[i] * -1) + 1;
    long long elem_pos = lower_bound(c.begin(), c.end(), elem) - c.begin();
    ans += i - elem_pos;
  }
  cout << ans << endl;
  return 0;
}
