#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 1;
int a[maxn], b[maxn];
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> v, v1;
  for (int i = 0; i <= n - 1; ++i) cin >> a[i];
  for (int i = 0; i <= n - 1; ++i) cin >> b[i];
  for (int i = 0; i <= n - 1; ++i) {
    if (a[i] - b[i] > 0)
      v.push_back(a[i] - b[i]);
    else
      v1.push_back(b[i] - a[i]);
  }
  long long ans = 0;
  ans += 1ll * v.size() * (v.size() - 1) / 2;
  sort((v).begin(), (v).end());
  if (v.size() == 0)
    cout << 0;
  else if (v1.size() == 0)
    cout << ans;
  else {
    for (int i = 0; i <= v1.size() - 1; ++i) {
      if (v1[i] >= v[v.size() - 1])
        continue;
      else
        ans +=
            v.size() - (upper_bound((v).begin(), (v).end(), v1[i]) - v.begin());
    }
    cout << ans;
  }
  return 0;
}
