/* -*- coding: utf-8 -*- * * 1374.cc: No.1374 Absolute Game - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N]; ll ss[2]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i); sort(as, as + n); for (int i = 0; i < n; i++) ss[i & 1] += as[i]; ll d = abs(ss[0]) - abs(ss[1]); if (! (n & 1) && d < 0) d = -d; printf("%lld\n", d); return 0; }