#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / (gcd(a, b)); }
bool isprime(long long n) {
  for (long long i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
long long ctoi(char c) { return c - 48; }
bool visited[1000000]{false};
void add_edge(vector<long long> v[], long long x, long long y) {
  v[x].push_back(y);
  v[y].push_back(x);
}
void dfs(vector<long long> v[], long long e) {
  visited[e] = true;
  for (long long i = 0; i < v[e].size(); i++) {
    if (!visited[v[e][i]]) {
      dfs(v, v[e][i]);
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  long long p, ne, z = 0;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  vector<long long> pos, neg;
  for (long long i = 0; i < n; i++) {
    long long diff = a[i] - b[i];
    if (diff < 0)
      neg.push_back(diff);
    else if (diff == 0)
      z++;
    else
      pos.push_back(diff);
  }
  long long count = 0;
  p = pos.size();
  ne = neg.size();
  count += p * (p - 1) / 2;
  count += z * p;
  sort(pos.begin(), pos.end());
  sort(neg.begin(), neg.end());
  if (pos.size() > 0) {
    long long mp = pos[p - 1];
    for (long long i = 0; i < ne; i++) {
      if ((neg[i] + mp) <= 0) continue;
      long long position =
          (upper_bound(pos.begin(), pos.end(), abs(neg[i])) - pos.begin());
      count += p - position;
    }
  }
  cout << count << "\n";
  return 0;
}
