#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const long long INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-9;
const double PI = acos(-1);
const int MOD = 998244353;
template <typename T>
inline T read() {
  T X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;
int a[MAXN], b[MAXN];
int c[MAXN], d[MAXN];
long long cnt;
int tmp[MAXN];
mt19937 mt(19270817);
struct Treap {
  struct Node {
    int v, sz, ch[2], p;
    Node() {}
    Node(int v) : v(v), sz(1), p(mt()) { ch[0] = ch[1] = 0; }
  };
  int root, tot;
  Node nodes[MAXN];
  int newNode(int v) {
    ++tot;
    nodes[tot] = Node(v);
    return tot;
  }
  void push_up(int p) {
    nodes[p].sz =
        p ? (1 + nodes[nodes[p].ch[0]].sz + nodes[nodes[p].ch[1]].sz) : 0;
  }
  int rank(int p) { return nodes[nodes[p].ch[0]].sz + 1; }
  void rotate(int& p, int d) {
    int t = nodes[p].ch[!d];
    nodes[p].ch[!d] = nodes[t].ch[d], nodes[t].ch[d] = p;
    push_up(p), push_up(t), p = t;
  }
  void insert(int& p, int v) {
    if (!p) return (void)(p = newNode(v));
    int d = nodes[p].v < v;
    insert(nodes[p].ch[d], v);
    if (nodes[p].p < nodes[nodes[p].ch[d]].p) rotate(p, !d);
    push_up(p);
  }
  void erase(int& p, int v) {
    if (!p) return;
    if (nodes[p].v != v)
      return erase(nodes[p].ch[(nodes[p].v < v)], v), push_up(p);
    if (nodes[p].ch[0] && nodes[p].ch[1]) {
      int d = nodes[nodes[p].ch[0]].p < nodes[nodes[p].ch[1]].p;
      rotate(p, !d), erase(nodes[p].ch[!d], v);
    } else {
      p = (nodes[p].ch[0]) ? nodes[p].ch[0] : nodes[p].ch[1];
    }
    push_up(p);
  }
  int kth(int p, int k) {
    int rk;
    while ((rk = rank(p)) != k) {
      if (rk > k)
        p = nodes[p].ch[0];
      else
        k -= rk, p = nodes[p].ch[1];
    }
    return nodes[p].v;
  }
  int rank(int p, int v) {
    int res = 1;
    while (p) {
      if (nodes[p].v < v)
        res += rank(p), p = nodes[p].ch[1];
      else
        p = nodes[p].ch[0];
    }
    return res;
  }
  int pre(int p, int v) {
    int res = 0;
    while (p) {
      if (nodes[p].v < v)
        res = p, p = nodes[p].ch[1];
      else
        p = nodes[p].ch[0];
    }
    return res ? nodes[res].v : v;
  }
  int post(int p, int v) {
    int res = 0;
    while (p) {
      if (v < nodes[p].v)
        res = p, p = nodes[p].ch[0];
      else
        p = nodes[p].ch[1];
    }
    return res ? nodes[res].v : v;
  }
};
Treap treap;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= n; i++) c[i] = a[i] - b[i];
  for (int i = 1; i <= n; i++) d[i] = b[i] - a[i];
  for (int i = 2; i <= n; i++) treap.insert(treap.root, d[i]);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += treap.rank(treap.root, c[i]) - 1;
    treap.erase(treap.root, d[i + 1]);
  }
  printf("%lld", ans);
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

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;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const long long INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-9;
const double PI = acos(-1);
const int MOD = 998244353;
template <typename T>
inline T read() {
  T X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;
int a[MAXN], b[MAXN];
int c[MAXN], d[MAXN];
long long cnt;
int tmp[MAXN];
mt19937 mt(19270817);
struct Treap {
  struct Node {
    int v, sz, ch[2], p;
    Node() {}
    Node(int v) : v(v), sz(1), p(mt()) { ch[0] = ch[1] = 0; }
  };
  int root, tot;
  Node nodes[MAXN];
  int newNode(int v) {
    ++tot;
    nodes[tot] = Node(v);
    return tot;
  }
  void push_up(int p) {
    nodes[p].sz =
        p ? (1 + nodes[nodes[p].ch[0]].sz + nodes[nodes[p].ch[1]].sz) : 0;
  }
  int rank(int p) { return nodes[nodes[p].ch[0]].sz + 1; }
  void rotate(int& p, int d) {
    int t = nodes[p].ch[!d];
    nodes[p].ch[!d] = nodes[t].ch[d], nodes[t].ch[d] = p;
    push_up(p), push_up(t), p = t;
  }
  void insert(int& p, int v) {
    if (!p) return (void)(p = newNode(v));
    int d = nodes[p].v < v;
    insert(nodes[p].ch[d], v);
    if (nodes[p].p < nodes[nodes[p].ch[d]].p) rotate(p, !d);
    push_up(p);
  }
  void erase(int& p, int v) {
    if (!p) return;
    if (nodes[p].v != v)
      return erase(nodes[p].ch[(nodes[p].v < v)], v), push_up(p);
    if (nodes[p].ch[0] && nodes[p].ch[1]) {
      int d = nodes[nodes[p].ch[0]].p < nodes[nodes[p].ch[1]].p;
      rotate(p, !d), erase(nodes[p].ch[!d], v);
    } else {
      p = (nodes[p].ch[0]) ? nodes[p].ch[0] : nodes[p].ch[1];
    }
    push_up(p);
  }
  int kth(int p, int k) {
    int rk;
    while ((rk = rank(p)) != k) {
      if (rk > k)
        p = nodes[p].ch[0];
      else
        k -= rk, p = nodes[p].ch[1];
    }
    return nodes[p].v;
  }
  int rank(int p, int v) {
    int res = 1;
    while (p) {
      if (nodes[p].v < v)
        res += rank(p), p = nodes[p].ch[1];
      else
        p = nodes[p].ch[0];
    }
    return res;
  }
  int pre(int p, int v) {
    int res = 0;
    while (p) {
      if (nodes[p].v < v)
        res = p, p = nodes[p].ch[1];
      else
        p = nodes[p].ch[0];
    }
    return res ? nodes[res].v : v;
  }
  int post(int p, int v) {
    int res = 0;
    while (p) {
      if (v < nodes[p].v)
        res = p, p = nodes[p].ch[0];
      else
        p = nodes[p].ch[1];
    }
    return res ? nodes[res].v : v;
  }
};
Treap treap;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= n; i++) c[i] = a[i] - b[i];
  for (int i = 1; i <= n; i++) d[i] = b[i] - a[i];
  for (int i = 2; i <= n; i++) treap.insert(treap.root, d[i]);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += treap.rank(treap.root, c[i]) - 1;
    treap.erase(treap.root, d[i + 1]);
  }
  printf("%lld", ans);
  return 0;
}

```