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 \le n \le 2 \cdot 10^5$) — the number of topics.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 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, \dots, b_n$ ($1 \le b_i \le 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
[{"code": "def main():\n    import sys\n    from bisect import bisect_left\n    input = sys.stdin.readline\n\n    N = int(input())\n    A = list(map(int, input().split()))\n    B = list(map(int, input().split()))\n    C = [a-b for a, b in zip(A, B)]\n    C.sort()\n\n    ans = 0\n    for i, c in enumerate(C):\n        j = bisect_left(C, -c+1)\n        ans += N-j\n        if c > 0:\n            ans -= 1\n    print(ans // 2)\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\n\nn=int(input())\nA=list(map(int,input().split()))\nB=list(map(int,input().split()))\n\nC=[A[i]-B[i] for i in range(n)]\nC.sort()\n\nimport bisect\nANS=0\n\nfor i in range(n):\n    x=bisect.bisect_right(C,-C[i])\n\n    ANS+=n-max(x,i+1)\n\nprint(ANS)\n", "passed": true, "time": 0.56, "memory": 14340.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\nfrom bisect import bisect_left\n\nn = int(input())\nx = [*map(int, input().split())]\ny = [xi - yi for xi, yi in zip(x, map(int, input().split()))]\n#print(y)\ny.sort()\nans = 0\nfor i in range(n):\n    k = y[i]\n    a = bisect_left(y, -k+1)\n    ans += n-a\n\nprint((ans - len([i for i in y if i > 0]))// 2)", "passed": true, "time": 0.23, "memory": 14260.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\nc = [a[i]-b[i] for i in range(n)]\nc.sort()\nind = n - 1\nwyn = 0\nfor i in range(n):\n\twhile True:\n\t\tif ind > i and c[i] + c[ind] > 0:\t\n\t\t\tind -= 1\n\t\telse:\n\t\t\tbreak\n\t\t\n\tif ind <= i:\n\t\tind = min(n-1,i)\n\twyn += (n-1-ind)\nprint(wyn)", "passed": true, "time": 0.14, "memory": 14344.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nimport sys\ninput = sys.stdin.readline\nimport bisect\nfrom collections import deque\n\nn = int(input())\na = [int(item) for item in input().split()]\nb = [int(item) for item in input().split()]\n\nc = []\nfor aa, bb in zip(a, b):\n    c.append(aa - bb)\n\nc.sort()\nc = deque(c)\nans = 0\nwhile c:\n    item = c.popleft()\n    val = len(c) - bisect.bisect_right(c, -item)\n    ans += val\nprint(ans)", "passed": true, "time": 0.21, "memory": 14388.0, "status": "done"}, {"code": "def go():\n    n = int(input())\n    a = list(map(int, input().split()))\n    b = list(map(int, input().split()))\n    dif = sorted(aa - bb for aa, bb in zip(a, b))\n    j = n - 1\n    res = 0\n    for i, d in enumerate(dif):\n        while j > -1 and d + dif[j] > 0:\n            j -= 1\n        res += n - 1 - j\n        if j < i:\n            res -= 1\n    return res // 2\n\n\n# t = int(input())\nfor _ in range(1):\n    print(go())\n", "passed": true, "time": 0.15, "memory": 14264.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nl = [x-y for x,y in zip(a,b)]\nl.sort()\nz = l.count(0)\np = sum(1 for x in l if x > 0)\nm = n - z - p\nidx = n\ncnt = p*(p-1)//2 + z*p\nfor i in range(m):\n    while l[idx-1] + l[i] > 0: idx -= 1\n    cnt += n - idx\nprint(cnt)", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "\nN = int(input())\n\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\n\nlis = []\n\nfor i in range(N):\n\n    lis.append(b[i]-a[i])\n\nlis.sort()\n\nans = 0\nsub = 0\n\nimport bisect\nfor i in range(N):\n\n    ns = a[i]-b[i]\n\n    ans += bisect.bisect_left(lis,ns)\n    if a[i] > b[i]:\n        sub += 1\n\nprint((ans-sub) // 2)\n", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "from bisect import bisect_right\nn=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nx=[i-j for i,j in zip(a,b)]\nx.sort()\nans=0\nfor i in x:\n  if i>0:ans-=1\n  ans+=n-bisect_right(x,-i)\nprint(ans//2)", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\nfrom bisect import bisect_right\n\nN = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = [a-b for a, b in zip(A, B)]\nC.sort()\n\nans = 0\nfor i, c in enumerate(C):\n    ind = bisect_right(C, -c)\n    ans += min(N-ind, N-i-1)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "import sys\nfrom bisect import bisect, bisect_left\n\ndef solve():\n    input = sys.stdin.readline\n    N = int(input())\n    A = [int(a) for a in input().split()]\n    B = [int(b) for b in input().split()]\n    C = [A[i] - B[i] for i in range(N)]\n    C.sort()\n    count = 0\n    for i, c in enumerate(C):\n        least = bisect(C, - c)\n        count += N - max(least, i + 1)\n    print(count)\n\n    return 0\n\ndef __starting_point():\n    solve()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nnow = []\nfor i in range(n):\n    now.append([a[i] - b[i], a[i], b[i]])\nnow.sort()\nans = 0\ni = 0\nj = n - 1\nwhile i < j:\n    if now[i][0] + now[j][0] > 0:\n        ans += j - i\n        j -= 1\n    else:\n        i += 1\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = []\nfor i in range (0, n) :\n    c.append(a[i] - b[i])\nc.sort()\np1 = n - 1\np2 = 0\nans = 0\nwhile p1 > p2 :\n    while p2 < p1 and c[p1] + c[p2] <= 0 :\n        p2 += 1\n    ans += p1 - p2\n    # print(ans)\n    p1 -= 1\nprint(ans)", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}]