#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  long long int a[n + 10], b[n + 10];
  vector<long long int> c;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) c.push_back(a[i] - b[i]);
  sort(c.begin(), c.end());
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    if (c[i] <= 0) continue;
    long long int pos = lower_bound(c.begin(), c.end(), -c[i] + 1) - c.begin();
    ans += (i - pos);
  }
  cout << ans << "\n";
}
int main() { solve(); }
