#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 3;
const int MAXV = 1e6 + 3;
const int MOD = 1e9 + 7;
int n, A[MAX], B[MAX], diff[MAX];
long long res;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> A[i];
  for (int i = 0; i < n; ++i) {
    cin >> B[i];
    diff[i] = A[i] - B[i];
  }
  sort(diff, diff + n);
  int l = 0, r = n - 1;
  while (l < r) {
    if (diff[l] + diff[r] > 0) {
      res += (r - l);
      r--;
    } else
      l++;
  }
  cout << res;
}
