#include <bits/stdc++.h>
long long power(long long base, long long exp) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base);
    base = (base * base);
    exp /= 2;
  }
  return res;
}
long long mod(long long a, long long b) { return (a % b + b) % b; }
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (auto &it : a) cin >> it;
  for (auto &it : b) cin >> it;
  vector<int> c(n);
  for (int i = 0; i < n; ++i) {
    c[i] = a[i] - b[i];
  }
  sort(c.begin(), c.end());
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    if (c[i] <= 0) continue;
    int pos = lower_bound(c.begin(), c.end(), -c[i] + 1) - c.begin();
    ans += i - pos;
  }
  cout << ans << '\n';
  return 0;
}
