Felix6326727/beyond-accuracy-code-comprehension huggingface dataset:
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
alice = 0
for i in range(0,N,2):
    alice += a[i]
bob = 0
for i in range(1,N,2):
    bob += a[i]
print(alice - bob)

# Example run
# Input:
-31
224
# Output:
0
def main(n, a):
    a.sort()
    ans = 0

    for i in range(n):
        if i % 2 == 0:
            ans += a.pop()
        else:
            ans -= a.pop()

    print(ans)


if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    main(n, a)


# Example run
# Input:
-5064
23763566
# Output:
0
N = int(input())
cards = [int(i) for i in input().split()]
cards.sort(reverse=True)

alice = cards[0::2]
bob = cards[1::2]
print(sum(alice) - sum(bob))


# Example run
# Input:
1107228
-109089799
# Output:
-109089799
import heapq
n = int(input())
a = list(map(lambda x: int(x)*(-1), input().split()))

heapq.heapify(a)
i = 1
alice = 0
bob = 0
while i <= n:
  if i % 2 == 1:
    alice += heapq.heappop(a)*(-1)
  else:
    bob += heapq.heappop(a)*(-1)
  i += 1
print(alice - bob)

# Example run
# Input:
-2090237817
-14
# Output:
0
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
Alice = 0
for i in range(0,N,2):
    Alice += A[i]
Bob = sum(A) - Alice
print(Alice - Bob)

# Example run
# Input:
-14993
-377
# Output:
377
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)

Alice = 0
Bob = 0
for i in range(n):
    if i % 2 == 0:
        Alice += a[i]
    else:
        Bob += a[i]

ans = Alice - Bob
print(ans)


# Example run
# Input:
-18231
54
# Output:
0
N = int(input())
a = list(map(int, input().split()))

al = 0
bo = 0
a.sort(reverse=True)
for i in range(len(a)):
    if i%2 == 0:
        al += a[i]
    else:
        bo += a[i]

print(al - bo)

# Example run
# Input:
30
1
# Output:
1
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)

Alice = sum([a for a in A[0::2]])
Bob = sum([a for a in A[1::2]])

print(Alice - Bob)

# Example run
# Input:
5354599
52
# Output:
52
n = int(input())
a = [int(x) for x in input().split()]

a.sort(reverse=True)
res = 0
s = 1
for d in a:
  res += s * d
  s *= -1

print(res)


# Example run
# Input:
3
-4169
# Output:
-4169
n = int(input())
li = list(map(int,input().split())) 
li.sort(reverse = True)
a,b = 0,0
while li:
    a += li.pop(0)
    if len(li) == 0:
        break
    b += li.pop(0)
print(a-b)

# Example run
# Input:
1
-124978655
# Output:
-124978655
N = int(input())
a = list(map(int, input().split()))
Alice = 0
Bob = 0
for i in range(N):
	if i % 2 == 0:
		Alice += max(a)
	else:
		Bob += max(a)
	a.remove(max(a))
print(Alice - Bob)

# Example run
# Input:
0
-11989124
# Output:
0
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2]) - sum(a[1::2]))


# Example run
# Input:
-4934
203
# Output:
203
N=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
A=sum(a[::2])
B=sum(a[1::2])
print(A-B)

# Example run
# Input:
-213932
0
# Output:
0
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(sum(a[::2])-sum(a[1::2]))

# Example run
# Input:
11756850
-18229
# Output:
-18229
N = int(input())
A = B = 0
li = list(map(int, input().split()))
N_li = sorted(li, reverse=True)
for i in range(N):
  if i%2==0:
    A += N_li[i]
  else:
    B += N_li[i]
print(A - B)

# Example run
# Input:
-445
31959
# Output:
0
n = int(input())
a = list(map(int, input().split()))

alice = []
bob = []

for i in range(n):
    if not a:
        break
    max_num = max(a)
    a.remove(max_num)
    alice.append(max_num)
    if not a:
        break
    max_num = max(a)
    a.remove(max_num)
    bob.append(max_num)

print(sum(alice) - sum(bob))


# Example run
# Input:
142
-30
# Output:
-30
def main():
  N = int(input())
  arr = sorted([int(x) for x in input().split()])[::-1]
  print(sum(arr[0::2]) - sum(arr[1::2]))


if __name__ == "__main__":
  main()


# Example run
# Input:
9062461
72046879
# Output:
72046879
n=int(input())
a=list(map(int,input().split()))
a.sort() 
alice_sum=0
bob_sum=0
if len(a)%2==0:
  for i in range(0,n,2):
    bob_sum+=a[i]
  for l in range(1,n,2):
    alice_sum+=a[l]
else:
  for i in range(0,n,2):
    alice_sum+=a[i]
  for k in range(1,n,2):
    bob_sum+=a[k]
    
print(alice_sum-bob_sum)



# Example run
# Input:
-37
1
# Output:
0
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
alice = sum(a[0::2])
bob = sum(a[1::2])
print(alice - bob)


# Example run
# Input:
-221907
-154
# Output:
-154
n = int(input())
a = list(map(int,input().split()))

a.sort(reverse = True)

su = 0

for i in range(n):
    if i % 2 == 0:
        su += a[i]
    else:
        su -= a[i]
print(su)

# Example run
# Input:
-647437
346
# Output:
0
N=int(input())
a=list(map(int, input().split()))
a.sort()
a=a[::-1]
A=sum([a[i] for i in range(0, N, 2)])
B=sum([a[i] for i in range(1, N, 2)])
print(A-B)

# Example run
# Input:
-5024207
-2147483648
# Output:
0
n=int(input())

a_list=[int(i) for i in input().split()]
a_list.sort(reverse=True)


alice=[]
bob=[]
for i in range(n):
    if i%2==0:
        alice.append(a_list[i])
    else:
        bob.append(a_list[i])
        
print(sum(alice)-sum(bob))

# Example run
# Input:
-1497
-105221
# Output:
0
_ = input()
a = [int(i) for i in input().split()]
a.sort()
a.reverse()
print(sum(a[::2]) - sum(a[1::2]))

# Example run
# Input:
vbzVvX+;\
1
# Output:
1
N = int(input())
A = list(map(int, input().split()))
A.sort()
A.reverse()
print(sum(A[::2]) - sum(A[1::2]))


# Example run
# Input:
3132478
-7930
# Output:
-7930
n = input()
a = list(map(int, input().split()))
a.sort(reverse=True)

print(sum(a[::2]) - sum(a[1::2]))

# Example run
# Input:
}C.-[
28
# Output:
28
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[::2])-sum(a[1::2]))

# Example run
# Input:
-2147483648
16667401
# Output:
16667401
n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
couA = 0
couB = 0
for i in range(0,len(a),2):
    couA +=a[i]
for j in range(1,len(a),2):
    couB +=a[j]
print(couA-couB)

# Example run
# Input:
0
1
# Output:
1
X = int(input())
A = list(map(int, input().split()))
list.sort(A, reverse=True)
B=0
C=0
ans = 0
for i,j in enumerate(A):
    print(i)
    if (i+1)%2 != 0:
        B+=j
    else :
        C+=j
ans = B-C
print(ans)
    




# Example run
# Input:
-1
-3439167
# Output:
0
-3439167
def resolve():
    N = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    Alice = []
    Bob = []
    for i, j in enumerate(a):
        if i % 2 == 0:
            Alice.append(j)
        else:
            Bob.append(j)
    print(sum(Alice) - sum(Bob))
    return

resolve()

# Example run
# Input:
-2090237817
-14
# Output:
-14
N = int(input())
a_li = list(map(int, input().split()))
a_li.sort(reverse=True)
alice = 0
bob = 0
for i in range(N):
    if i % 2 == 0 :
        alice += a_li[i]
    else :
        bob += a_li[i]
print(alice - bob)


# Example run
# Input:
0
4081983
# Output:
0
# input
N = int(input())
A = list(map(int, input().split()))

# check
res = 0
Alice_Turn = True
while A:
    max_a = max(A)
    if Alice_Turn:
        res += max_a
        Alice_Turn = False
    else:
        res -= max_a
        Alice_Turn = True
    A.remove(max_a)

print(res)

# Example run
# Input:
-274078593
-28418
# Output:
-28418
N = int(input())
a = sorted(list(map(int,input().split())),reverse = True)
Alice = sum(a[::2])
Bob = sum(a[1::2])
print(Alice - Bob)

# Example run
# Input:
-197
-1
# Output:
-1
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    n=int(input())
    A=sorted(list(map(int,input().split())), reverse=True)

    print(sum(A[::2])-sum(A[1::2]))


resolve()

# Example run
# Input:
-1168909
0
# Output:
0
n = int(input())
a = sorted(list(map(int,input().split())),reverse = True)
print(sum(a[::2])-sum(a[1::2]))


# Example run
# Input:
-1098720
-224231
# Output:
-224231
N = int(input())
ls = list(map(int,input().split()))
ls.sort(reverse=True)
a = 0
b = 0
for i in range(N):
    if i % 2 == 0:
        a += ls[i]
    else:
        b += ls[i]
print(a-b)

# Example run
# Input:
1
-3108573
# Output:
-3108573
N = int(input())
a = list(map(int,input().split()))

a.sort(reverse=True)

ALICE = sum(a[::2])
BOB = sum(a[1::2])

print(ALICE-BOB)

# Example run
# Input:
215616622
-58138
# Output:
-58138
Alice,Bob=0,0
N=int(input())
L=list(map(int,input().split()))
L=sorted(L,reverse=True)
for i in range(N):
  if i%2==0:
    Alice+=L[i]
  else:
    Bob+=L[i]
print(Alice-Bob)

# Example run
# Input:
-14
0
# Output:
0
N=int(input())
alise=0
bob=0
a_list=list(map(int,input().split()))
a_sort=sorted(a_list)[::-1]
a_sort.append(0)
for i in range(N//2+N%2):
    alise+=a_sort.pop(0)
    bob+=a_sort.pop(0)
print(alise-bob)

# Example run
# Input:
-5
-56556289
# Output:
0
N = int(input())
A = list(map(int, input().split()))
asum=0
bsum=0
cnt=0
while True:
    asum+=max(A)
    A.remove(max(A))
    cnt+=1
    if cnt==N:
        break
    bsum+=max(A)
    A.remove(max(A))
    cnt+=1
    if cnt==N:
        break

print(asum-bsum)

# Example run
# Input:
1
2147483647
# Output:
2147483647
N=int(input())
A=list(map(int,input().split()))
L=sorted(A,reverse=True)
print(sum(L[0::2])-sum(L[1::2]))

# Example run
# Input:
-59158
10823
# Output:
10823
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

Alice = a[:n:2]
Bob = a[1:n:2]

print(sum(Alice)-sum(Bob))

# Example run
# Input:
9062461
72046879
# Output:
72046879
n = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
alice = A[::2]
Bob = A[1::2]
print(sum(alice)-sum(Bob))

# Example run
# Input:
13
-123410341
# Output:
-123410341
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
al = a[::2]
b = a[1::2]
print(sum(al)-sum(b))

# Example run
# Input:
-252699780
988493674
# Output:
988493674
n = int(input())
a_list = list(map(int, input().split()))

a_list.sort(reverse = True)

a_point = 0
b_point = 0

for i in range(n):
  if i % 2 == 0:
    a_point += a_list[i]
  else:
    b_point += a_list[i]

print(a_point - b_point)

# Example run
# Input:
-331
18
# Output:
0
dat =list(input().split())

for i in dat:
	i = int(i)

dat.sort(reverse=True)

asum = 0
bsum = 0
sum=0

for i in range(len(dat)):
     asum =  dat[i]
		
print(asum)

# Example run
# Input:
0
# Output:
0
N = int(input())
a = list(map(int, input().rstrip().split()))
a.sort(reverse=True)
alice = sum(a[::2])
bob = sum(a[1::2])
print(alice - bob)


# Example run
# Input:
-39355
1
# Output:
1
N = int(input())
a = map(int, input().split())
sorted_a = sorted(list(a), reverse=True)
Alice = 0
Bob = 0
for i in range(N):
    if i % 2 == 0:
        Alice += sorted_a[i]
    else:
        Bob += sorted_a[i]
result = Alice - Bob
print(result)

# Example run
# Input:
-18850
1484193033
# Output:
0
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2]) - sum(a[1::2]))

# Example run
# Input:
20616
-11392175
# Output:
-11392175
N = int(input())
a = map(int,input().split())
b = sorted(a,reverse=True)
for i in range(1,N,2):
    b[i] = -1*b[i]
print(sum(b))

# Example run
# Input:
-607
681963
# Output:
681963
N = int(input())
a = [int(x) for x in input().split()]
a.sort()
a.reverse()
score = 0
for ind,i in enumerate(a):
    if(ind%2==0):
        score+=i
    else:
        score-=i
print(score)


# Example run
# Input:
49968
20415230
# Output:
20415230
input()
cards = sorted(map(int, input().rstrip("\n").split()), reverse=True)

print(sum(cards[::2]) - sum(cards[1::2]))


# Example run
# Input:
}[:jG
1186387
# Output:
1186387
n = int(input())
a_list = [int(a) for a in input().split(' ')]
a_list = sorted(a_list, reverse=True)
alice = list()
bob = list()
for i, a in enumerate(a_list):
    if i % 2 == 0:
        alice.append(a)
    else:
        bob.append(a)
print(sum(alice) - sum(bob))

# Example run
# Input:
-52564348
-7737
# Output:
-7737
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

Alice = 0
Bob = 0
for i in range(N):
    if i % 2 == 0:
        Alice += A[i]
    else:
        Bob += A[i]
print(Alice - Bob)



# Example run
# Input:
-15915
-501843
# Output:
0
n = int(input())
A = list(map(int,input().split()))
A.sort()
alice = 0
bob = 0
for i in range(1,n+1):
    if (int(i)%2==0):
        bob += A[n-i]
    else:
        alice += A[n-i]
print(alice-bob)


# Example run
# Input:
-1
-3439167
# Output:
0
# -*- coding: utf-8 -*-
# input
a = int(input())
num = [int(a) for a in input().split()]

# Sort
num.sort(reverse=True)

ans = sum(num[0::2]) - sum(num[1::2])

print(ans)


# Example run
# Input:
-30
-3011
# Output:
-3011
n = int(input())
d = list(map(int, input().split()))
d.sort(reverse = True)
a = sum(d[::2])
b = sum(d[1::2])
print(a -b) 

# Example run
# Input:
415326
-1201474778
# Output:
-1201474778
# -*- coding: utf-8 -*-

n = int(input())
nums = [int(x) for x in input().split()]
alice = 0
bob = 0
while nums != []:
    alice += max(nums)
    nums.remove(max(nums))
    if nums != []:
        bob += max(nums)
        nums.remove(max(nums))
print(alice - bob)

# Example run
# Input:
-68037
7842
# Output:
7842
n = int(input())
card = list(map(int, input().split()))
card.sort(reverse=1)
alice = 0
bob = 0
for i in range(1,n+1):
    if i%2==0:
        bob += card[i-1]
    else: alice += card[i-1]
if alice >= bob:
    print(alice - bob)
else: print(bob-alice)

# Example run
# Input:
0
-318594
# Output:
0
n = int(input())
a = sorted([int(i) for i in input().split()], reverse=True)

alice = sum([a[i] for i in range(0, n, 2)])
bob = sum([a[i] for i in range(1, n, 2)])
print(alice - bob)


# Example run
# Input:
-194715587
-2938
# Output:
0
N = int(input())
List = [int(x) for x in input().split()]
Sum = sum(List)
List.sort(reverse=True)
del List[::2]
Sum_B = sum(List)
Sum_A = Sum-Sum_B
print(Sum_A-Sum_B)

# Example run
# Input:
-967
-58799
# Output:
-58799
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2]) - sum(a[1::2]))

# Example run
# Input:
0
-11989124
# Output:
-11989124
n=int(input())
s=list(map(int,input().split()))
s.sort(reverse=True)
print(s)
tokuten=0
for i in range(n):
    if i%2==0:
        tokuten+=s[i]
    else:
        tokuten-=s[i]

print(tokuten)

# Example run
# Input:
-5271130
19
# Output:
[19]
0
a = int(input())
l=list(map(int ,input().split()))
list.sort(l, reverse=True)
alice=0
bob=0
for i in range(a):
    if i==0 or i%2==0:
        alice=alice+l[i]
    else:
        bob=bob+l[i]    
print(alice-bob)

# Example run
# Input:
-11989124
-407
# Output:
0
N = int(input())
score = list(map(int, input().split()))
A = 0
B = 0
 
score.sort(reverse=True)
for i in range(N):
  if i % 2 == 0:
    A += score[i]
  else:
    B += score[i]

print(A-B)

# Example run
# Input:
-398
986892
# Output:
0
n = int(input())
numbers = list(map(int,input().split()))
alice = []
a = sum(numbers)
numbers.sort()
b = int(n/2)
if n%2 == 0 :
    for i in range(b) :
        alice.append(int(numbers[2*i+1])) 
else :
    for j in range(b+1) :
        alice.append(int(numbers[2*j])) 

x = sum(alice)
y = a - x
print(x - y)

# Example run
# Input:
-13
7381
# Output:
-7381
N = int(input())
l = list(map(int, input().split()))
a = 0
b = 0
l.sort(reverse=True)
for i in range(len(l)):
    if i % 2 == 0:
        a += l[i]
    else:
        b += l[i]
total = a - b
print(total)

# Example run
# Input:
139893
5182
# Output:
5182
# -*- coding: utf-8 -*-

import math

n = int(input())
a = list(map(int, input().split()))

#aを昇順でSort
a.sort()
a.reverse()

sumA = 0
sumB = 0

# print(a)
sumA = sum(a[0::2])

sumB = sum(a[1::2])
print(sumA-sumB)

# Example run
# Input:
-4116
-2154
# Output:
-2154
def solve(n, a_list):
    tmp = sorted(a_list, reverse=True)
    
    alice_score = sum([x for i, x in enumerate(tmp) if i % 2 == 0])
    bob_score = sum([x for i, x in enumerate(tmp) if i % 2 == 1])
    return alice_score - bob_score

if __name__ == "__main__":
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print(solve(n, a_list))



# Example run
# Input:
-2090237817
-14
# Output:
-14
n = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

Alice = sum(A[::2])
Bob = sum(A[1::2])

ans = Alice - Bob
print(ans)

# Example run
# Input:
2147483647
165
# Output:
165
N = int(input())
a = list(map(int, input().split()))

sort_a = sorted(a, reverse=True)

cnt = 0
Alice = 0
Bob = 0
for i in sort_a:
    if cnt % 2 == 0:
        Alice += i
    else:
        Bob += i
    cnt += 1

print(Alice - Bob)

# Example run
# Input:
-330
-2503
# Output:
-2503
N = int(input())
a = list(map(int, input().split()))
Alice = 0
Bob = 0
a = sorted(a,reverse = True)
for i in range(N):
    if (i+1)%2 == 1:
        Alice += a[i]
    else:
        Bob += a[i]
print(Alice-Bob)

# Example run
# Input:
0
805965556
# Output:
0
Alice = 0
Bob = 0

N = int(input())
A = [None] * N
A = list(map(int, input().split()))

for i in range(N):
    if i % 2:
        Bob = Bob + max(A)
        A.remove(max(A))
    else:
        Alice = Alice + max(A)
        A.remove(max(A))

print(Alice - Bob)

# Example run
# Input:
-11989124
-407
# Output:
0
N = int(input())
A = list(map(int, input().split()))
Alice = []
Bob = []
A.sort(reverse=True)

for i in range(N):
    if i%2 == 0:
        Alice.append(A[i])
    elif i%2 == 1:
        Bob.append(A[i])

ans = sum(Alice) - sum(Bob)
print(ans)

# Example run
# Input:
-32942311
298151
# Output:
0
_ = input()
a = [int(x) for x in input().split()]

a.sort(reverse=True)

ans = 0

while len(a) > 0:
    ans += a.pop(0)
    if len(a) == 0:
        break
    ans -= a.pop(0)

print(ans)


# Example run
# Input:
wWw\1XA]
7
# Output:
7
N = int(input())
A = list(map(int, input().split()))
Alice = 0
A.sort(reverse=True)
for i in range(0,N,2):
  Alice += A[i]
print(2*Alice - sum(A))

# Example run
# Input:
-4868286
-104837
# Output:
104837
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)

print(sum(A[0::2])-sum(A[1::2]))


# Example run
# Input:
-2239572
-31
# Output:
-31
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)

Alice, Bob = 0, 0

if N // 2 * 2 != N:             # odd
    for i in range(0,N-2,2):
        Alice += a[i]
        Bob += a[i+1]
    Alice += a[N-1]
else:                           # even
    for i in range(0,N,2):
        Alice += a[i]
        Bob += a[i+1]

print(Alice - Bob)

# Example run
# Input:
-69520
-73864104
# Output:
0
N=int(input())
a=list(map(int,input().split()))
a.sort(key=int,reverse=True)
A,B=[],[]
for i in a:
    if len(A)==len(B): A.append(i)
    else : B.append(i)
print(sum(A)-sum(B))

# Example run
# Input:
-7038374
-6
# Output:
-6
n=int(input())
A=list(map(int,input().split(' ')))
A.sort()
a=0
b=0
i=0
while i < n:
    if i%2==0:
        a+= A[i]
    else:
        b += A[i]
    i += 1
print(a-b)

# Example run
# Input:
-377
-491914923
# Output:
0
# coding: utf-8
import math
n = input()
N = map(int, input().split())
N = sorted(list(N), reverse=True)

a = sum(N[::2])
b = sum(N[1::2])
print(a - b)


# Example run
# Input:
8YU=Cz
607
# Output:
607
n = int(input())  #一応読むけど、ループ回せば不要では
aList=list(map(int,input().split()))

aList.sort(reverse = True)

ap = 0
bp = 0

for i,a in enumerate(aList):
    if i%2 == 0: #0から始まるので偶数奇数逆で考える
        ap = ap + a
    else:
        bp = bp + a
print(ap-bp)

# Example run
# Input:
0
-11989124
# Output:
-11989124
n=input()
a=sorted(map(int,input().split()))
print(sum(a[::-2])-sum(a[-2::-2]))

# Example run
# Input:
Gg>
56
# Output:
56
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
alice = 0
bob = 0
for i in range(len(arr)):
    if i%2 == 0:
        alice += arr[i]
    else:
        bob += arr[i]
print(abs(alice-bob))

# Example run
# Input:
-2058894
298151
# Output:
298151
# coding: utf-8
n = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)

alice = 0
bob = 0
for i in range(n):
    a = cards[i]
    if i % 2:
        bob += a
    else:
        alice += a
print(alice-bob)

# Example run
# Input:
-259420352
376395
# Output:
0
N=int(input())
tuple=input()
list=tuple.split()
list_int=[int(i) for i in list]
list=sorted(list_int)
Alice_Score=0
Bob_Score=0
for num in list[-1::-2]:
    Alice_Score+=num
for num in list[-2::-2]:
    Bob_Score+=num
difference=Alice_Score-Bob_Score
print(difference)


# Example run
# Input:
-224231
-640183291
# Output:
-640183291
N = int(input())
cards = list(map(int, input().split()))

alice = 0
bob = 0

for i in range(int(N/2) + 1):
	if len(cards) > 0:
		alice += max(cards)
		cards.remove(max(cards))
	if len(cards) > 0:
		bob += max(cards)
		cards.remove(max(cards))
	
print(alice - bob)
	
	
	

# Example run
# Input:
4
4
# Output:
4
n = int(input())
a = list(map(int, input().split()))

a.sort()

alice = 0
bob = 0


for i in range(n):
    if i % 2 ==0:
        alice += a[i]
    else:
        bob += a[i]

print(abs(alice-bob))


# Example run
# Input:
-1
96
# Output:
0
N = int(input())
a = sorted(map(int, input().split()))
if N%2==0:
    print(sum(i for i in a[1::2])-sum(j for j in a[0::2]))
else:
    print(sum(j for j in a[0::2])-sum(i for i in a[1::2]))

# Example run
# Input:
-695
-9
# Output:
-9
N = int(input())
A = list(map(int, input().split()))
n = range(N)
list_Alice = [0]
list_Bob = [0]
A.sort()
for i in n:
  if i%2 == 0:
    list_Alice.append(A[i])
  else:
    list_Bob.append(A[i])
print(sum(list_Alice) - sum(list_Bob))

# Example run
# Input:
-213
-5
# Output:
0
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
nl = list(range(1,n+1))
for i in a:
  if nl.pop(0)%2 == 0:
    ans -= i
  else:
    ans += i
print(abs(ans))

# Example run
# Input:
45607
-877447
# Output:
877447
N = int(input())
a = list(map(int,input().split()))
a.sort()
a.reverse()
Alice = []
Bob = []
if N % 2 == 0:
    for i in range(N//2):
        Alice.append(a[i*2])
        Bob.append(a[i*2+1])
elif N % 2 == 1 and N != 1:
    for i in range((N-1)//2):
        Alice.append(a[i*2])
        Bob.append(a[i*2+1])
        Alice.append(a[-1])
        print(sum(Alice) - sum(Bob))
else:
    print(a[0])

# Example run
# Input:
-39547
-46095437
# Output:
N=int(input())
A=list(map(int,input().split()))

Alice=0
Bob=0
n=1

while n<=N:
  if n%2==1:
    Alice=Alice+max(A)
    A.remove(max(A))
    n=n+1
  else:
    Bob=Bob+max(A)
    A.remove(max(A))
    n=n+1
print(Alice-Bob)

# Example run
# Input:
-233787
58991
# Output:
0
n = int(input())
a_list = list(map(int, input().split()))
a_list = sorted(a_list, reverse=True)

alice_point = 0
bob_point = 0
for i in range(n):
    if i % 2 == 0:
        alice_point += a_list[i]
    else:
        bob_point += a_list[i]

print(alice_point - bob_point)

# Example run
# Input:
1
-7617381
# Output:
-7617381
N = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
print(2 * sum([a[i] for i in range(N) if i % 2 == 0]) - sum(a))


# Example run
# Input:
-19797306
311070
# Output:
-311070
code=int(input())
arr = list(map(int, input().split()))
sumone=0
for i in range(code):
    for j in range(i+1,code):
        if arr[i]<arr[j]:
            box=arr[j]
            arr[j]=arr[i]
            arr[i]=box
for i in range(code):
    if i%2==0:
        sumone+=arr[i]
    else:
        sumone-=arr[i]
print(sumone)


# Example run
# Input:
-170
-478262
# Output:
0
N = int(input())
li = list(map(int, input().split()))
li = sorted(li, reverse=True)

ans = sum(li[::2]) - sum(li[1::2])
print(ans)


# Example run
# Input:
609389
11
# Output:
11
n = int(input())
cards = list(sorted(map(int, input().split()), reverse=True))

a = sum(cards[0::2])
b = sum(cards[1::2])

print(a - b)


# Example run
# Input:
1973033
-264371717
# Output:
-264371717
N=int(input())
A=[int(i) for i in input().split()]
A.sort(reverse=True)
ali=[]
bob=[]

for i in range(N//2):
    ali.append(A[i*2])
    bob.append(A[i*2+1])
if N%2==1:
    ali.append(A[-1])
    
        
print(sum(ali)-sum(bob))

# Example run
# Input:
0
-14125092
# Output:
0
N = int(input())
A = list(map(int,input().split()))

A.sort(reverse=True)
print((sum(A[::2])) - sum(A[1::2]))

# Example run
# Input:
230
1745
# Output:
1745