#include <bits/stdc++.h>
using namespace std;
bool prime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long int power(long long int x, long long int y) {
  long long int temp;
  if (y == 0) return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else
    return x * temp * temp;
}
long long int no_of_factors(long long int n) {
  long long int cnt = 0;
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        cnt++;
      else
        cnt = cnt + 2;
    }
  }
  return cnt;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool subsequence_checker(string str1, string str2, long long int m,
                         long long int n) {
  if (m == 0) return true;
  if (n == 0) return false;
  if (str1[m - 1] == str2[n - 1])
    return subsequence_checker(str1, str2, m - 1, n - 1);
  return subsequence_checker(str1, str2, m, n - 1);
}
bool isPowerOfTwo(long long int x) { return x && (!(x & (x - 1))); }
struct test {
 public:
  long long int x, y, z;
};
bool compare(const test &aa, const test &bb) {
  if (aa.x == bb.x) {
    if (aa.y == bb.y) {
      return aa.z < bb.z;
    }
    return aa.y < bb.y;
  }
  return aa.x < bb.x;
}
long long int inv(long long int a) {
  long long int b = 998244353 - 2, ans = 1;
  for (; b > 0; a = a * a % 998244353, b >>= 1)
    if (b & 1) ans = ans * a % 998244353;
  return ans;
}
long long int a_pow_b(long long int a, long long int b) {
  long long int ans = 1;
  for (; b > 0; a = a * a % 998244353, b >>= 1)
    if (b & 1) ans = ans * a % 998244353;
  return ans;
}
long long int ncr(long long int n, long long int m) {
  if (m > n) return 0;
  long long int up = 1, down = 1;
  for (int i = n - m + 1; i < n + 1; i++) up *= i, up %= 998244353;
  for (int i = 1; i < m + 1; i++) down *= i, down %= 998244353;
  return up * inv(down) % 998244353;
}
void AcDegaYe() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  long long int b[n];
  for (long long int i = 0; i < n; i++) cin >> b[i];
  vector<long long int> neg, pos;
  for (long long int i = 0; i < n; i++) {
    long long int val = a[i] - b[i];
    if (val > 0) {
      pos.push_back(val);
    } else {
      neg.push_back(abs(val));
    }
  }
  long long int c = pos.size();
  long long int ans = c * (c - 1);
  ans /= 2;
  sort(neg.begin(), neg.end());
  for (long long int i = 0; i < c; i++) {
    long long int val =
        (lower_bound(neg.begin(), neg.end(), pos[i]) - neg.begin());
    ans = ans + val;
  }
  cout << ans << endl;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    AcDegaYe();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
