#include<bits/stdc++.h>
using namespace std;
int main(){
int i,n=0,m,s=0,x=0;
cin>>i;
for(n=1;n<=i;n++){
cin>>m;
if(m%2==0) s=s+m;
else x=x+m;
}
cout<<x<<endl<<s;
return 0;
}
/**************************************************************
Problem: 1174
User: wtq001
Language: C++
Result: Accepted
Time:11 ms
Memory:2072 kb
****************************************************************/