#include <bits/stdc++.h>
long double pi = acos(-1);
long long z = 1000000007;
using namespace std;
const int N = 2e5 + 7;
long long power(long long a, long long b, long long p) {
  if (b == 0) return 1;
  long long c = power(a, b / 2, p);
  if (b % 2 == 0)
    return ((c * c) % p);
  else
    return ((((c * c) % p) * a) % p);
}
void solve() {
  long long n;
  cin >> n;
  int arr1[n];
  int arr2[n];
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    arr1[i] = x;
  }
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    arr2[i] = x;
  }
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    long long d = arr1[i] - arr2[i];
    v.push_back(d);
  }
  long long ans = 0;
  sort(v.begin(), v.end());
  long long temp = 0;
  for (long long i = n - 1; i >= 0; i--) {
    if (v[i] <= 0) break;
    for (long long j = temp; j < i; j++) {
      if (-(v[j]) < v[i]) {
        ans += (i - j);
        temp = j;
        break;
      }
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
