Problem:
Score: 200 points

Problem Statement

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 1

2
3 1

Sample Output 1

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.

Sample Input 2

3
2 7 4

Sample Output 2

5

First, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.

Sample Input 3

4
20 18 2 18

Sample Output 3

18

Solution in C (GCC 5.4.1) (judge verdict: Accepted)

#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>

const char solve_[] = { 0x6a, 0x00, 0x48, 0x89, 0xf8, 0x48, 0x01, 0xc0, 0x48, 0x01, 0xc0, 0x48, 0x01, 0xf0, 0x50, 0x56, 0x41, 0x58, 0x49, 0x83, 0xf8, 0x00, 0x74, 0x50, 0x41, 0x59, 0x4c, 0x89, 0xc9, 0x4c, 0x29, 0xc1, 0x48, 0x83, 0xf9, 0x04, 0x76, 0xea, 0x4d, 0x89, 0xc2, 0x4d, 0x89, 0xcb, 0x41, 0x8b, 0x00, 0x49, 0x83, 0xc2, 0x04, 0x41, 0x0f, 0xbe, 0x0a, 0x39, 0xc1, 0x73, 0xf4, 0x49, 0x83, 0xeb, 0x04, 0x41, 0x0f, 0xbe, 0x13, 0x39, 0xc2, 0x72, 0xf4, 0x4d, 0x39, 0xd3, 0x76, 0x08, 0x41, 0x89, 0x0b, 0x41, 0x89, 0x12, 0xeb, 0xdb, 0x41, 0x89, 0x10, 0x41, 0x89, 0x03, 0x41, 0x53, 0x41, 0x50, 0x49, 0x83, 0xc3, 0x04, 0x41, 0x51, 0x41, 0x53, 0xeb, 0xa8, 0x48, 0x31, 0xc0, 0x48, 0x31, 0xc9, 0x48, 0x31, 0xd2, 0x48, 0x39, 0xcf, 0x0f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x48, 0x83, 0xfa, 0x00, 0x74, 0x09, 0x48, 0x2b, 0x04, 0x8e, 0x48, 0xff, 0xca, 0xeb, 0x07, 0x48, 0x03, 0x04, 0x8e, 0x48, 0xff, 0xc2, 0x48, 0xff, 0xc1, 0x48, 0x39, 0xcf, 0x77, 0xd9, 0xc3 };

int main(void){
	int fd = open("/dev/zero", O_RDONLY);
	int (*solve)(int, int *) = mmap(NULL, sizeof solve_, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
	memcpy(solve, solve_, sizeof solve_);

	int n, a[123];
	scanf("%d", &n);
	for(int i = 0; i < n; ++i) scanf("%d", a + i);
	printf("%d\n", solve(n, a));

	close(fd);
	munmap(solve, sizeof solve_);
	return 0;
}