We have N cards. A number a_i is written on the i-th card.

Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.

The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.

-----Constraints-----
 - N is an integer between 1 and 100 (inclusive).
 - a_i \ (1 \leq i \leq N) is an integer between 1 and 100 (inclusive).

-----Input-----
Input is given from Standard Input in the following format:  
N
a_1 a_2 a_3 ... a_N

-----Output-----
Print Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.

-----Sample Input-----
2
3 1

-----Sample Output-----
2

First, Alice will take the card with 3. Then, Bob will take the card with 1.
The difference of their scores will be 3 - 1 = 2.
[{"code": "def main():\n    N = int(input())\n    A = list(map(int, input().split()))\n    alice = 0\n    bob = 0\n    A.sort(reverse=True)\n    for i, a in enumerate(A):\n        if i%2 == 0:\n            alice += a\n        else:\n            bob += a\n    print((alice - bob))\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.16, "memory": 14208.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na.sort(reverse=True)\nalice = 0\nbob = 0\nfor i in range(0,n,2):\n    alice += a[i]\n    if i == n-1:\n        break\n    bob += a[i+1]\nprint(alice-bob)", "passed": true, "time": 0.15, "memory": 14136.0, "status": "done"}, {"code": "i = input()\nl = list(map(int, input().split()))\n\ndl = list(sorted(l))\ndl = list(reversed(dl))\n\nans = 0\n\nfor i in range(len(dl)):\n    if i % 2 == 0:\n        ans += dl[i]\n    else:\n        ans -= dl[i]\n\nprint(ans)\n", "passed": true, "time": 0.19, "memory": 14236.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int,input().split()))\n\nA = sorted(a,reverse=True)\nalice = sum(A[0::2])\nbob = sum(A[1::2])\n\nprint(alice - bob)", "passed": true, "time": 0.38, "memory": 14168.0, "status": "done"}, {"code": "n = int(input())\nc = list(map(int,input().split()))\nc.sort(reverse = True)\na = 0\nb = 0\nif n % 2 == 0:\n    for i in range(n // 2 ):\n        a += c[i * 2]\n        b += c[i * 2 + 1]\nelse:\n    for i in range(n // 2 ):\n        a += c[i * 2]\n        b += c[i * 2 + 1]\n    a += c[n - 1]\n\nprint(a - b)", "passed": true, "time": 0.38, "memory": 14088.0, "status": "done"}, {"code": "n = int(input())\nlist_a = sorted([int(i) for i in input().split()], reverse=True)\nans = 0\nfor i in range(0, len(list_a)):\n    if i % 2 == 0: ans += list_a[i]\n    else: ans -= list_a[i]\nprint(ans)", "passed": true, "time": 0.15, "memory": 14152.0, "status": "done"}, {"code": "n = int(input())\ni = list(map(int, input().split()))\ni.sort(reverse=True)\nprint(sum(i[0::2])-sum(i[1::2]))", "passed": true, "time": 0.15, "memory": 14088.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nprint(sum(a[::2]) - sum(a[1::2]))", "passed": true, "time": 0.15, "memory": 14140.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\nAlice = []\nBob = []\na.sort()\na.reverse()\n\nfor x in range(n):\n    if x % 2 == 0:\n        Alice.append(a[x])\n    else:\n        Bob.append(a[x])\n\nprint(sum(Alice) - sum(Bob))", "passed": true, "time": 1.65, "memory": 14076.0, "status": "done"}, {"code": "n=int(input())\nans=0\nA=sorted(list(map(int,input().split())))[::-1]\nfor i in range(n):\n  if i % 2 == 0:\n    ans += A[i]\n  else:\n    ans -= A[i]\nprint(ans)", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "def max_index(a: list) -> int:\n    return a.index(max(a))\n\n\ndef main():\n    n = int(input())\n    a = list(map(int, input().split()))\n    alice_number = 0\n    bob_number = 0\n    while len(a) > 0:\n        alice_number += a.pop(max_index(a))\n        if len(a) == 0:\n            break\n        else:\n            bob_number += a.pop(max_index(a))\n    print((alice_number - bob_number))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 1.65, "memory": 14280.0, "status": "done"}, {"code": "N = int(input())\ncards = list(map(int, input().split()))\nalice = []\nbob = []\n\ncards.sort(reverse=True)\n\nfor i in range(N):\n    if i%2 == 0:\n        alice.append(cards[i])\n    else:\n        bob.append(cards[i])\n\nprint((sum(alice) - sum(bob)))\n", "passed": true, "time": 0.33, "memory": 14324.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int, input().split()))\n\ndef sort_reverse(n):\n    n.sort(reverse=True)\n    return n\n\nN_Even = list(range(0, N, 2))\nN_Odd = list(range(1, N, 2))\na1 = sort_reverse(a)\nsum1 = 0\nsum2 = 0\n\nfor i in N_Even:\n    sum1 += a1[i]\nfor j in N_Odd:\n    sum2 += a1[j]\n\nprint(sum1 - sum2)", "passed": true, "time": 0.17, "memory": 14316.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nA.sort()\nAlice = 0\nBob = 0\nwhile 1:\n    try:\n        Alice += A.pop(-1)\n    except IndexError:\n        break\n    try:\n        Bob += A.pop(-1)\n    except IndexError:\n        break\nprint(Alice-Bob)", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "def main():\n\n    n = int(input())\n    cards = list(map(int, input().split()))\n    cards.sort(reverse=True)\n    alice, bob = 0, 0\n    if n % 2 == 0:\n        for i in range(int(n / 2)):\n            alice += cards[2 * i]\n            bob += cards[2 * i + 1]\n    else:\n        for j in range(int(n / 2)):\n            alice += cards[2 * j]\n            bob += cards[2 * j + 1]\n        alice += cards[n - 1]\n    ans = alice - bob\n    print(ans)\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.32, "memory": 14272.0, "status": "done"}, {"code": "n = int(input())\nli = list(map(int,input().split()))\nli.sort(reverse = True)\nif n % 2 == 0:\n    a = 0\n    b = 0\n    for i in range(int(n/2)):\n        a += li[2*i]\n        b += li[2*i+1]\n    ans = a - b\n    print(ans)\nelse:\n    a = 0\n    b = 0\n    for i in range(int((n-1)/2)):\n        a += li[2*i]\n        b += li[2*i+1]\n    ans = a + li[n-1] - b\n    print(ans)", "passed": true, "time": 0.14, "memory": 14072.0, "status": "done"}, {"code": "def ans088(N:int, a: str):\n    a = list(map(int, a.split()))\n    list.sort(a,reverse=True)\n    Alice_count=0\n    Bob_count=0\n    for i in range(len(a)):\n        if (i+1)%2==1:\n            Alice_count+=a[i]\n        else:\n            Bob_count+=a[i]\n    return Alice_count-Bob_count\n\nN=int(input())\na=input()\nprint((ans088(N,a)))\n\n", "passed": true, "time": 0.14, "memory": 14212.0, "status": "done"}, {"code": "import sys\nlines = [s.rstrip(\"\\n\") for s in sys.stdin.readlines()]\nn, = [int(num) for num in lines.pop(0).split(\" \")]\na_list = [int(num) for num in lines.pop(0).split(\" \")]\na_list.sort(reverse=True)\nalice_sum = sum(a_list[i] for i in range(0, n, 2))\nbob_sum = sum(a_list) - alice_sum\nprint((alice_sum - bob_sum))\n", "passed": true, "time": 0.23, "memory": 14224.0, "status": "done"}, {"code": "n = int(input())\nai = list(map(int, input().split()))\nai_sort = sorted(ai, reverse=True)\nalice = ai_sort[::2]\nprint(sum(alice) - (sum(ai) - sum(alice)))", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\na = sorted(a, reverse=True)\nalice = 0\nbob = 0\nfor i in range(len(a)):\n    if i%2==0:\n        alice += a[i]\n    if i%2==1:\n        bob += a[i]\nprint(alice-bob)", "passed": true, "time": 0.15, "memory": 14272.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nA.sort()\n\nS = 0\nT = 0\nans = 0\n\nfor i in range(N):\n    if N%2 == 0:\n        if i%2 != 0:\n            S += A[i]\n        else:\n            T += A[i]\n        ans = S - T\n    else:\n        if i%2 != 0:\n            T += A[i]\n        else:\n            S += A[i]\n        ans = S - T\n\nprint(ans)\n", "passed": true, "time": 0.15, "memory": 14152.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\ns=0\na.sort()\ns=sum(a[:n:2])-sum(a[1:n:2])\nif s>0:\n    print(s)\nelse:\n    print(-s)", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "n = int(input())\nai = list(map(int, input().split()))\nai_sort = sorted(ai)\nalice = []\nfor i in range(-1, -n - 1, -2):\n    alice.append(ai_sort[i])\nprint(sum(alice) - (sum(ai) - sum(alice)))", "passed": true, "time": 0.14, "memory": 14332.0, "status": "done"}, {"code": "N = int(input())\na = sorted(map(int,input().split()),reverse=True)\nprint(sum(a[0::2])-sum(a[1::2]))", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "N = int(input())\nnums = list(map(int, input().split()))\nnums.sort(reverse=True)\nAlice = []\nBob = []\ni = 0\nif N % 2 == 0:\n    while i<=N-1:\n        Alice.append(nums[i])\n        Bob.append(nums[i+1])\n        i += 2\nelse:\n    while i<=N-2:\n        Alice.append(nums[i])\n        Bob.append(nums[i+1])\n        i += 2\n    Alice.append(nums[N-1])\nsum_allice = sum(Alice)\nsum_bob = sum(Bob)\nanswer = sum_allice - sum_bob\nprint(answer)", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\na.sort(reverse=True)\nnum = len(a)\nalice = []\nbob = []\ncoun = 1\nfor i in a:\n    if coun % 2 == 1:\n        alice.append(i)\n    else:\n        bob.append(i)\n    coun += 1\nans = abs(sum(alice) - sum(bob))\nprint(ans)", "passed": true, "time": 0.15, "memory": 14096.0, "status": "done"}, {"code": "n = int(input())\ndata = list(map(int,input().split()))\ndata.sort(reverse = True)\nprint(sum(data[::2]) - sum(data[1::2]))", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\nn = int(input())\na = list(map(int, input().split()))\n\na.sort(reverse=True)\n\nx = 0\ny = 0\nfor i in range(len(a)):\n    if i % 2 == 0:\n        x += a[i]\n    else:\n        y += a[i]\n\nprint((x-y))\n", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "N=int(input())\na = list(map(int,input().split()))\n\na.sort(reverse=True)\nalice=0\nbob=0\ntf=True\nfor i in a:\n    if tf:\n        alice+=i\n    else:\n        bob+=i\n    tf=not tf\nprint((alice-bob))\n", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "n = input()\na = sorted(list(map(int,input().split())),reverse=True)\n\nprint((sum(a[::2])-sum(a[1::2])))\n", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "n = int(input())\nli = list(map(int,input().split()))\nli.sort(reverse=True)\nalice = []\nbob = []\nfor i in range(n):\n    if i % 2 == 0:\n        alice.append(li[i])\n    else:\n        bob.append(li[i])\nprint(sum(alice)-sum(bob))", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int, input().split()))\na.sort(reverse=True)\nAlice, Bob = 0, 0\n\nfor i in range(N):\n    if i % 2 == 0:\n        Alice += a[i]\n    else:\n        Bob += a[i]\nprint(Alice - Bob)", "passed": true, "time": 0.14, "memory": 14076.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int, input().split()))\n\na.sort()\na.reverse()\n\nalice = 0\nbob = 0\nfor i in range(N):\n    if i % 2 == 0:\n        alice += a[i]\n    else:\n        bob += a[i]\nprint((alice - bob))\n", "passed": true, "time": 0.4, "memory": 14268.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, a: \"List[int]\"):\n    a = list(reversed(sorted(a)))\n    alice = [a_[1] for a_ in enumerate(a) if a_[0] % 2 == 0]\n    bob = [a_[1] for a_ in enumerate(a) if a_[0] % 2 == 1]\n    # print(alice, bob)\n    print((sum(alice) - sum(bob)))\n    return\n\n\n# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n    def iterate_tokens():\n        for line in sys.stdin:\n            for word in line.split():\n                yield word\n    tokens = iterate_tokens()\n    N = int(next(tokens))  # type: int\n    a = [int(next(tokens)) for _ in range(N)]  # type: \"List[int]\"\n    solve(N, a)\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.16, "memory": 14176.0, "status": "done"}, {"code": "from typing import List\n\n\ndef answer(n: int, a: List[int]) -> int:\n    alice = 0\n    bob = 0\n\n    a.sort(reverse=True)\n    for i in range(0, len(a), 2):\n        alice += a[i]\n    for j in range(1, len(a), 2):\n        bob += a[j]\n\n    return abs(alice - bob)\n\n\ndef main():\n    n = int(input())\n    a = list(map(int, input().split()))\n    print((answer(n,a)))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.25, "memory": 15452.0, "status": "done"}, {"code": "def resolve():\n    N = int(input())\n    an = sorted([int(n) for n in input().split()], reverse=True)\n\n    print(sum(an[::2]) - sum(an[1::2]))\n\n\ndef __starting_point():\n    resolve()\n__starting_point()", "passed": true, "time": 0.17, "memory": 14112.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\ns=0\na.sort()\ns=sum(a[:n:2])-sum(a[1:n:2])\n\nprint(abs(s))", "passed": true, "time": 0.16, "memory": 14244.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nalice = 0\nbob = 0\na.sort(reverse = True)\nfor i in range(0, n, 2):\n    alice += a[i]\nfor i in range(1, n, 2):\n    bob += a[i]\nprint(alice - bob)", "passed": true, "time": 0.25, "memory": 14228.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int, input().split()))\na.sort(reverse=True)\nAlice = 0\nBob = 0\nflag=True\nfor i in a:\n    if flag==True:\n        Alice += i\n        flag = False\n    else:\n        Bob += i\n        flag = True\nprint((Alice-Bob))\n", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\na.sort(reverse=True)\nalice=0\nbob=0\nfor i in range(n):\n    if i%2==0:alice+=a[i]\n    else:bob+=a[i]\nprint(alice-bob)", "passed": true, "time": 0.16, "memory": 14116.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nsa = sorted(a, reverse = True)\nal = 0\nbo = 0\nfor i in range(n):\n  if i % 2 == 0:\n    al += sa[i]\n  else:\n    bo += sa[i]\nprint((al - bo))\n", "passed": true, "time": 0.16, "memory": 14280.0, "status": "done"}, {"code": "n=int(input())\nlst=list(map(int,input().split()))\n\nalice=0\nbob=0\n\nlst.sort()\nfor i in range(n):\n    if i%2==0 :\n        alice+=lst.pop()\n    else :\n        bob+=lst.pop()\nprint((alice-bob))\n", "passed": true, "time": 0.14, "memory": 14052.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())),reverse = True)\nAlice = 0\nBob = 0\ncount = 0\n\nwhile True:\n    Alice += a[count]\n    count += 1\n    if count == n:\n        print(Alice - Bob)\n        return\n    Bob += a[count]\n    count += 1\n    if count == n:\n        print(Alice - Bob)\n        return", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int,input().split()))\na.sort(reverse=True)\n\nAlice_point = 0\nBob_point = 0\n\nfor i in range(N):\n    if i % 2 == 0:\n        Alice_point += a[0]\n        a.pop(0)\n\n    else:\n        Bob_point += a[0]\n        a.pop(0)\n\nprint(Alice_point - Bob_point)", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())), reverse=True)\nprint(sum(a[::2]) - sum(a[1::2]))", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n = int(input())\na = [int(x) for x in input().split()]\na.sort(reverse = True)\nres = 0\nfor i in range(n):\n  if i % 2 == 0:\n    res += a[i]\n  else:\n    res -= a[i]\nprint(res)", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "N=int(input())\na=list(map(int,input().split()))\na.sort(reverse=True)\nprint((sum(a[::2])-sum(a[1::2])))\n", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int,input().split()))\n\na.sort(reverse=True)\n\nans = 0\n\nfor i in range(0,N):\n  ans = ans + a[i]*(-1)**i\n\n  \nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14184.0, "status": "done"}, {"code": "getint = lambda: int(input())\ngetints = lambda: map(int, input().split())\ngetlist = lambda: list(getints())\nn = getint()\na = getlist()\na.sort(reverse=True)\nalice = bob = 0\nfor i in range(n):\n    if i % 2:\n        bob += a[i]\n    else:\n        alice += a[i]\nprint(alice - bob)", "passed": true, "time": 0.15, "memory": 14192.0, "status": "done"}, {"code": "N = int(input())\n\ncards = [int(s) for s in input().split()]\nlist.sort(cards, reverse=True)\na_cards = cards[0::2]\nb_cards = cards[1::2]\nprint(sum(a_cards)-sum(b_cards))", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na.sort()\na.reverse()\nx = sum(a[::2])-sum(a[1::2])\nprint(x)\n", "passed": true, "time": 0.14, "memory": 14072.0, "status": "done"}, {"code": "n = int(input())\na=list(map(int, input().split()))\na.sort()\nA = []\nB = []\nfor i in range(1,n+1):\n    if i % 2 != 0:\n        A.append(a[-i])\n    else:\n        B.append(a[-i])\nprint(sum(A) - sum(B))", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\na = sorted(a,reverse=True)\nA = sum(a[0::2])\nB = sum(a[1::2])\nprint((A - B))\n\n", "passed": true, "time": 0.16, "memory": 14324.0, "status": "done"}, {"code": "N = int(input())\nlist1 = list(map(int,input().split()))\n\nlist1.sort(reverse=True)\n\nalice = 0\nbob = 0\nfor i in range(len(list1)):\n    if i % 2 == 0:\n        alice += list1[i]\n    else:\n        bob += list1[i]\n\nprint((alice - bob))\n", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int,input().split()))\na.sort()\na.reverse()\nalice = 0\nbob = 0\nfor i in range(N) :\n    if i%2 == 0 : \n        alice += a[i]\n    elif i%2 == 1 :\n        bob += a[i]\nprint((alice-bob))\n", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int,input().split()))\n\ncard = list(a)\ncard.sort(reverse=True)\nAlice = []\nBob = []\n\nif len(card) % 2 != 0:\n    Alice.append(card[-1])\n    card.pop(-1)\n\nwhile card:\n    Alice.append(card[0])\n    Bob.append(card[1])\n    card.pop(0)\n    card.pop(0)\n\nprint((sum(Alice)-sum(Bob)))\n", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nalice = 0\nbob = 0\n\na_sort = sorted(a, reverse=True)\n\nfor i in range(n):\n    if i%2 == 0:\n        alice += a_sort[i]\n    else:\n        bob += a_sort[i]\n\nprint(alice-bob)", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\na.sort(reverse=True)\nal = 0\nbo = 0\nfor i in range(n):\n    if i%2==0:\n        al += a[i]\n    else:\n        bo += a[i]\nprint(al-bo)", "passed": true, "time": 0.16, "memory": 14272.0, "status": "done"}, {"code": "N = int(input())\nnums = [int(s) for s in input().split()]\nnums = sorted(nums, reverse=True)\n\nAlice = 0\nBob = 0\ni = 0\nwhile nums:\n    if i % 2 == 0:\n        Alice += nums.pop(0)\n    else:\n        Bob += nums.pop(0)\n    i += 1\n\nprint(Alice-Bob)", "passed": true, "time": 0.73, "memory": 14100.0, "status": "done"}, {"code": "# coding: utf-8\n# Your code here!\nN=int(input())\nA=list(int(x) for x in input().split())\n\nA.sort(reverse=True)\n\nans=0\nfor i in range(N):\n  a=A[i]\n  if i%2==0:\n    ans += a\n  else:\n    ans -= a\n  \nprint(ans)\n", "passed": true, "time": 0.28, "memory": 14052.0, "status": "done"}, {"code": "N = int(input())\nlst = input().split()\n\nfor i in range(N):\n   lst[i] = int(lst[i])\nlst.sort(reverse=True)\n\nAlice = 0\nBob = 0\n\nfor i in range(N // 2):\n   Alice += lst[2 * i]\n   Bob += lst[(2 * i) + 1]\n\nif N % 2 == 1:\n   Alice += lst[-1]\n\nprint(Alice - Bob)", "passed": true, "time": 0.28, "memory": 14132.0, "status": "done"}, {"code": "def mapt(fn, *args):\n    return tuple(map(fn, *args))\n\n\ndef Input():\n    return mapt(int, input().split(\" \"))\n\n\ndef main():\n    n = int(input())\n    a = sorted(Input(), reverse=True)\n    alice = bob = 0\n    for i in range(n):\n        if i % 2 == 0:\n            alice += a[i]\n        else:\n            bob += a[i]\n    \n    print(alice - bob)\n\n\nmain()", "passed": true, "time": 0.23, "memory": 14184.0, "status": "done"}, {"code": "N=int(input())\ncard_list=list(map(int,input().split()))\n#\u5404\u81ea\u304c\u81ea\u5206\u306e\u6570\u5b57\u3092\u6700\u5927\u5316\u3059\u308b\u3088\u3046\u306b\u9078\u629e\u3059\u308b\u306e\u304c\u524d\u63d0\u306a\u306e\u3067Alice\u304c\u78ba\u5b9f\u306b\u52dd\u3064\u3002\n#Alice\u306f\uff11\u756a\u76ee\u3001\uff13\u756a\u76ee\u3001\uff15\u756a\u76ee\u3001\uff17\u756a\u76ee\u30fb\u30fb\u30fb\u306b\u53d6\u3063\u3066\u3044\u304f\n#Bob\u306f\uff12\u756a\u76ee\u3001\uff14\u756a\u76ee\u3001\uff16\u756a\u76ee\u3001\uff18\u756a\u76ee\u30fb\u30fb\u30fb\u306b\u53d6\u3063\u3066\u3044\u304f\n#sort\u95a2\u6570\u306b\u306f\u3001\u300creverse\u300d\u3068\u3044\u3046\u5f15\u6570\u304c\u5b58\u5728\u3057\u307e\u3059\u3002reverse\u3092True\u306b\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u300c\u964d\u9806\u300d\u3092\u793a\u3059\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\n\ncard_list.sort(reverse=True)\n#print(card_list)\n\ncard_list_Alice=card_list[::2]\n#print(card_list_Alice)\nAlice_score=sum(card_list_Alice)\n#print(Alice_score)\nBob_score=sum(card_list)-Alice_score\n#print(Bob_score)\n#Alice_score=card_list[1]+card_list[3]+\n#Bob_score=card_list[2]+card_list[4]+\n\nprint((Alice_score-Bob_score))\n", "passed": true, "time": 0.24, "memory": 14072.0, "status": "done"}, {"code": "N = int(input())\na_lst = list(map(int, input().split()))\n\na_lst.sort(reverse = True)\n\nA_a_lst = []\nB_a_lst = []\n\nfor i in range(N):\n    if i % 2 == 0:\n        A_a_lst.append(a_lst[i])\n    else:\n        B_a_lst.append(a_lst[i])\n\nA_sum = sum(A_a_lst)\nB_sum = sum(B_a_lst)\n\nans = A_sum - B_sum\nprint(ans)", "passed": true, "time": 0.22, "memory": 14048.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\ncnt = 0\n\na.sort(reverse=True)\n\nfor i in range(n):\n    if i%2 == 0:\n        cnt += a[i]\n    else:\n        cnt -= a[i]\n\nprint(cnt)\n", "passed": true, "time": 0.32, "memory": 14180.0, "status": "done"}, {"code": "n = int(input())\nan = list(map(int, input().split()))\n\n\nclass Solution:\n    def __init__(self, n, an):\n        self.n = n\n        self.an = an\n\n    @staticmethod\n    def __reverse_an():\n        r_an = sorted(an, reverse=True)\n        return r_an\n\n    def answer(self):\n        r_an = self.__reverse_an()\n        ans = 0\n        for index, r_ai in enumerate(r_an):\n            if index % 2 == 0:\n                ans += r_ai\n            else:\n                ans -= r_ai\n        print(ans)\n\n\nconditions = Solution(n, an)\nconditions.answer()", "passed": true, "time": 0.17, "memory": 14308.0, "status": "done"}, {"code": "N=int(input())\na=list(map(int,input().split()))\na.sort(reverse=True)\n\nalice=0\nfor i in range(0,N,2):\n    alice+=a[i]\n\nbob=sum(a)-alice\nprint(alice-bob)", "passed": true, "time": 0.17, "memory": 14124.0, "status": "done"}, {"code": "N = int(input())\n\nA = list(map(int, input().split()))\n\nAlice = 0\nBob = 0\n\nwhile len(A) != 0:\n    Alice += max(A)\n    A.remove(max(A))\n    if len(A) == 0:\n        break\n    Bob += max(A)\n    A.remove(max(A))\n    if len(A) == 0:\n        break\n\nprint(Alice-Bob)", "passed": true, "time": 0.17, "memory": 14208.0, "status": "done"}, {"code": "#!/usr/local/bin/python3\n# https://atcoder.jp/contests/abc088/tasks/abc088_b\n\n_ = int(input())\nA = sorted(list(map(int, input().split())))[::-1]\n\nans = 0\nfor i, a in enumerate(A):\n    if i % 2 == 0:\n        ans += a\n    else:\n        ans -= a\n\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "n = int(input())\nx = list(map(int, input().split()))\n\na = 0\nb = 0\nx = sorted(x)\n\nfor i in range(n):\n    if i % 2 == 0:\n        a += x.pop()\n    else:\n        b += x.pop()\n\nprint(a-b)", "passed": true, "time": 0.15, "memory": 14256.0, "status": "done"}, {"code": "n = int(input())\nall_cards = list(map(int, input().split()))\nall_cards.sort(reverse=True)\n\nalice_cards = []\nbob_cards = []\n\nfor i in range(n):\n    if i % 2 == 0:\n        alice_cards.append(all_cards[i])\n    if i % 2 == 1:\n        bob_cards.append(all_cards[i])\n\nprint(sum(alice_cards)-sum(bob_cards))", "passed": true, "time": 0.17, "memory": 14236.0, "status": "done"}, {"code": "n = int(input())\na = [int(i) for i in input().split()]\na.sort(reverse=True)\n\nans = 0\nfor i in range(n):\n  if i % 2 == 0:\n    ans += a[i]\n  else:\n    ans -= a[i]\n    \nprint(ans)", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n = int(input())\ncards = list(map(int,input().split()))\ncards = sorted(cards,reverse=True)\nalice = bob = 0\nfor i in cards[::2]:\n    alice += i\nfor j in cards[1::2]:\n    bob += j\nprint(alice - bob)", "passed": true, "time": 0.15, "memory": 14100.0, "status": "done"}, {"code": "N = input()\nli = list(map(int,input().split()))\nli.sort(reverse=True)\nAlice = 0\nBob = 0\nfor i in range(len(li)):\n    if (i + 1)% 2 == 1:\n        Alice += li[i]\n    if (i +1)% 2 == 0:\n        Bob += li[i]\nprint((Alice - Bob))\n\n", "passed": true, "time": 0.21, "memory": 14140.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())),reverse=True)\nAlice = sum(a[::2])\nBob = sum(a[1::2])\nprint(Alice-Bob)", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nal = []\nbb = []\n\na.sort(reverse=True)\n\nfor i in range(n):\n  if i%2 == 1:\n    bb.append(a[i])\n  else:\n    al.append(a[i])\n  \nprint((sum(al) - sum(bb)))\n\n", "passed": true, "time": 0.23, "memory": 14204.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nA.sort(reverse=True)\nsum1=0\nsum2=0\nfor num in range(N):\n  if num % 2 == 0:\n    sum1 += A[num]\n  else:\n    sum2 += A[num]\nprint(sum1 - sum2)", "passed": true, "time": 0.14, "memory": 14052.0, "status": "done"}, {"code": "N = int(input())\nC = list(map(int,input().split()))\nAlice = []\nBob = []\n\nC = sorted(C,reverse=True)\nfor i in range(0,N):\n    if i %2 == 0:\n        Alice.append(C[i])\n    else:\n        Bob.append(C[i])\n\nprint(sum(Alice) - sum(Bob))", "passed": true, "time": 0.14, "memory": 14344.0, "status": "done"}, {"code": "N = int(input())\na = [int(b) for b in input().split()]\nAlice = 0\nBob = 0\n\nfor i in range(1, N+1):\n  if i % 2 == 1:\n    Alice += a.pop(a.index(max(a)))\n  else:\n    Bob += a.pop(a.index(max(a)))\n\nprint(str(Alice - Bob))", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "n = int(input())\nl = list(map(int, input().split()))\nl.sort(reverse=True)\na = 0\nb = 0\nzyu = 0\nfor i in l:\n    if zyu == 0:\n        a += i\n        zyu = 1\n    else:\n        zyu = 0\n        b += i\nif a < b:\n    print((b - a))\nelif a > b:\n    print((a - b))\nelse:\n    print(\"0\")\n", "passed": true, "time": 0.15, "memory": 14240.0, "status": "done"}, {"code": "N = int(input())\n\na = sorted(list(map(int,input().split())),reverse=True)\n\nAlice = sum([a[i] for i in range(N) if i%2 == 0])\nBob= sum([a[i] for i in range(N) if i%2 == 1])\nprint(Alice-Bob)", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\n\nAlice = 0\nBob = 0\nfor i in range(N):\n    maxA = max(A)\n    A.remove(maxA)\n    if i % 2 == 0:\n        Alice += maxA\n    else:\n        Bob += maxA\n\nprint(\"{}\".format(Alice - Bob))", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "n=int(input())\nn_list=list(map(int,input().split()))\nalice=[]\nbob=[]\nwhile(n_list!=[]):\n    a=max(n_list)\n    alice.append(a)\n    n_list.remove(a)\n    if(n_list==[]):\n        break\n    b=max(n_list)\n    bob.append(b)\n    n_list.remove(b)\nprint(sum(alice)-sum(bob))", "passed": true, "time": 0.14, "memory": 14332.0, "status": "done"}, {"code": "N = input()\ncard = list(map(int, input().split()))\n\nA = []\nB = []\nt = 'A'\nwhile card:\n    if t == 'A':\n        A.append(max(card))\n        card.remove(max(card))\n        t = 'B'\n    else:\n        B.append(max(card))\n        card.remove(max(card))\n        t = 'A'\n\nprint(sum(A) - sum(B))", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "# coding: utf-8\n# Your code here!\n\nn = int(input())\nA = list(map(int, input().split()))\n\nsum_a = 0\nsum_b = 0\n\nsorted_A = sorted(A, reverse = True)\n\nflag = 1\nfor i in sorted_A : \n    if flag == 1 : \n        sum_a += i\n        flag = 0\n    else : \n        sum_b += i\n        flag = 1\n        \nprint(sum_a - sum_b)", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\na.sort(reverse = True)\nA = 0\nB = 0\nfor i in range(n):\n  if i%2 == 0:\n    A += a[i]\n  else:\n    B += a[i]\nprint(A-B)", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nA.sort(reverse=True)\n\nprint((sum(A[0::2])-sum(A[1::2])))\n", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na.sort(reverse=True)\nans = 0\nfor i in range(n):\n    if i%2:\n        ans -= a[i]\n    else:\n        ans += a[i]\nprint(ans)", "passed": true, "time": 0.14, "memory": 14040.0, "status": "done"}, {"code": "n = int(input())\na = [int(s) for s in input().split()]\na.sort(reverse=True)\nalice = sum(a[0:n:2])\nbob = sum(a[1:n:2])\n\nprint(alice - bob)", "passed": true, "time": 0.14, "memory": 14052.0, "status": "done"}, {"code": "n = int(input())\narr = list(map(int, input().split(\" \")))\n\n# Sort arr, firstly\narr.sort(reverse=True)\n\na_arr = []\nb_arr = []\n\nfor (i, ele) in enumerate(arr):\n    # Alice\n    if i % 2 == 0:\n        a_arr.append(ele)\n    # Bob\n    else:\n        b_arr.append(ele)\n\nprint(sum(a_arr) - sum(b_arr))", "passed": true, "time": 0.14, "memory": 13992.0, "status": "done"}, {"code": "n=int(input())\nx = [int(i) for i in input().split()]\nxx = sorted(x)\nans=0\naaa=0\nif n%2==0:\n  for i in range(n//2):\n    ans+=xx[i*2+1]-xx[i*2]\n  print(ans)\nelse:\n  for i in range(n//2):\n    ans+=xx[i*2+1]-xx[i*2]\n  aaa=xx[n-1]-ans\n  print(aaa)", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int,input().split()))\na.sort(reverse=True)\nflag = 0\nalice = 0\nbob = 0\nfor i in range(N):\n    if flag == 0:\n        alice += a[i]\n        #print(\"alice:\"+str(alice))\n        flag = 1\n    else:\n        bob += a[i]\n        #print(\"bob:\"+str(bob))\n        flag = 0\nprint(alice - bob)", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int, input().split()))\na.sort(reverse = True)\nans = 0\nfor num in range(N):\n  if num % 2 == 0:\n    ans += a[num]\n  else:\n    ans -= a[num]\nprint(ans)", "passed": true, "time": 0.14, "memory": 14040.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int, input().split()))\na.sort(reverse=True)\n\nA = 0\nB = 0\nfor i in range(N):\n  if i % 2 ==0:\n    A += a[i]\n  else:\n    B += a[i]\n\ndiff = A - B\nprint(diff)", "passed": true, "time": 0.14, "memory": 14344.0, "status": "done"}, {"code": "def solve1(n, lst):\n    alice, bob = 0, 0\n\n    #print(\" i |a[i]|Alice|Bob\")\n    # print(\"------------------\")\n\n    for i in range(n):\n        if i % 2 == 0:\n            alice += lst[i]\n        else:\n            bob += lst[i]\n        # print(f\"{i:3d}|{a[i]:3d}|{alice:5d}|{bob:5d}\")\n\n    return alice - bob\n\n\nn = int(input())\na = list(map(int, input().split(\" \")))\na.sort(reverse=True)\nprint((solve1(n, a)))\n", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}]