#include<iostream>
#include<fstream>
using namespace std;
int main()
{
	ifstream f1;f1.open("CHANLE.inp");
	long long int n;
	f1>>n;
	long long int a[n];
	for(int i=0;i<n;i++)
	{
		f1>>a[i];
	}
	f1.close();
	long long int dem1=0,dem2=0,tong1=0,tong2=0;
	ofstream f2;f2.open("CHANLE.out");
	for(int i=0;i<n;i++)
	{
			if(a[i]%2==0)
			{
				dem1++;
				tong1=tong1+ a[i];
			}
			else 
			{
				dem2++;
				tong2=tong2+a[i];
			}
	}
	f2<<tong1<<" "<<dem1<<endl;
	f2<<tong2<<" "<<dem2;
	f2.close();
}
	
	
