mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline N = int(input()) C = list(map(int, input().split())) C.sort() A = B = 0 for i, c in enumerate(C): if i&1: B += c else: A += c if N&1: print(abs(A) - abs(B)) else: print(abs(abs(A) - abs(B))) if __name__ == '__main__': main()