#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 9;
const long long N = 500500;
signed main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;
  long long n, ans = 0;
  cin >> n;
  vector<long long> a(n), b(n), c(n);
  for (auto &x : a) cin >> x;
  for (auto &x : b) cin >> x;
  for (long long i = 0; i < n; i++) {
    c[i] = a[i] - b[i];
  }
  sort((c).begin(), (c).end());
  for (long long i = 0; i < n; i++) {
    ans += c.end() - upper_bound((c).begin(), (c).end(), -c[i]);
    if (c[i] > -c[i]) ans--;
  }
  cout << ans / 2;
  return 0;
}
