#include <iostream>
#include<bits/stdc++.h>
using namespace std;
pair<int,int> SumOfArray(int n ,int a[]){
int sum=0;
int odd=0;
for(int i=0;i<n;i++){
if(a[i]%2==0){
sum=sum+a[i];
}
else{
odd=odd+a[i];
}
}
return {sum,odd};
}
int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
pair<int,int> res=SumOfArray(n,a);
cout<<res.first<<" "<<res.second;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKcGFpcjxpbnQsaW50PiBTdW1PZkFycmF5KGludCBuICxpbnQgYVtdKXsKCWludCBzdW09MDsKCWludCBvZGQ9MDsKCWZvcihpbnQgaT0wO2k8bjtpKyspewoJCWlmKGFbaV0lMj09MCl7CgkJCXN1bT1zdW0rYVtpXTsKCQl9CgkJZWxzZXsKCQkJb2RkPW9kZCthW2ldOwoJCX0KCX0KCXJldHVybiB7c3VtLG9kZH07Cn0KCmludCBtYWluKCkgewoJaW50IG47CgljaW4+Pm47CglpbnQgYVtuXTsKCWZvcihpbnQgaT0wO2k8bjtpKyspewoJCWNpbj4+YVtpXTsKCX0KCXBhaXI8aW50LGludD4gcmVzPVN1bU9mQXJyYXkobixhKTsKCWNvdXQ8PHJlcy5maXJzdDw8IiAiPDxyZXMuc2Vjb25kOwoJcmV0dXJuIDA7Cn0=