#include<bits/stdc++.h>
using namespace std;

int main(){
    int n, j = 0, o = 0;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++) {
        if(a[i] % 2 == 0) {
            o += a[i];
        } else {
            j += a[i];
        }
    }
    cout << j << endl << o;
    return 0;
}
/**************************************************************
	Problem: 1174
	User: wuzhijing
	Language: C++
	Result: Accepted
	Time:13 ms
	Memory:2072 kb
****************************************************************/