// Arup Guha
// 6/13/2024
// Solution to Kattis Problem: Falling Apart
// https://open.kattis.com/problems/fallingapart

using namespace std;
#include <bits/stdc++.h>

int main() {

    int n, alice = 0, bob = 0;
    cin >> n;

    // Sort numbers from big to small.
    vector<int> nums(n);
    for (int i=0; i<n; i++)
        cin >> nums[i];
    sort(nums.rbegin(), nums.rend());

    // Give money alternately to alice and bob.
    for (int i=0; i<n; i++) {
        if (i%2 == 0) alice += nums[i];
        else bob += nums[i];
    }

    cout << alice << " " << bob << endl;
    return 0;
}
