#include <bits/stdc++.h>
using namespace std;
long long x,n,i,dem1,dem2,t1,t2;
int main()
{
cin>>n;
t1=0;
t2=0;
dem1=0;
dem2=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0)
{
dem1++;
t1+=x;
}
else
{
dem2++;
t2+=x;
}
}
cout<<t1<<" "<<dem1<<endl;
cout<<t2<<" "<<dem2;
return 0;
}