#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());
  sort(pos.begin(), pos.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;
}

### Prompt

Please create a solution in Cpp to the following problem:

The next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.

The pair of topics i and j (i < j) is called good if a_i + a_j > b_i + b_j (i.e. it is more interesting for the teacher).

Your task is to find the number of good pairs of topics.

Input

The first line of the input contains one integer n (2 ≤ n ≤ 2 ⋅ 10^5) — the number of topics.

The second line of the input contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9), where a_i is the interestingness of the i-th topic for the teacher.

The third line of the input contains n integers b_1, b_2, ..., b_n (1 ≤ b_i ≤ 10^9), where b_i is the interestingness of the i-th topic for the students.

Output

Print one integer — the number of good pairs of topic.

Examples

Input


5
4 8 2 6 2
4 5 4 1 3


Output


7


Input


4
1 3 2 4
1 3 2 4


Output


0

### Response

```cpp
#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());
  sort(pos.begin(), pos.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;
}

```