#include #include #include #include using ll = std::int64_t; int main() { int n; std::cin >> n; std::vector c(n); for (ll &e : c) std::cin >> e; ll sum = std::accumulate(std::begin(c), std::end(c), 0ll); if (sum < 0) { for (auto &e : c) e *= -1; } std::sort(std::rbegin(c), std::rend(c)); ll av = 0, bv = 0; for (int i = 0; i < n; i++) { (i & 1 ? bv : av) += c[i]; } std::cout << std::abs(av) - std::abs(bv) << std::endl; return 0; }