#include <iostream>
#include <iomanip>
#include <fstream>

using namespace std;

double calAverage(int [], int);
void calBiggest(int);

int main()
{
	int R=20, V=20;
	int num, n, n1, n2, num1[R], num2[R];
	int i=0, j=0;
	ifstream inp("numbers2.txt");
	
	inp>>n;
	
	for(int k=0; k<n; k++)
	{
		inp>>n1;
		if(n1%2==0)
		{
			num1[i]=n1;
			i++;
		}
		if(n1%2 != 0)
		{
			num2[j]=n1;
			j++;
		}
	}
	
	int highest1=-999999;
	for(int a=0; a<i; a++)
	{
		if (highest1<num1[a])
		highest1=num1[a];
	}
	cout << fixed << setprecision(1);
	cout << "The even numbers are:\n";
	for(int a=0; a<i; a++)
	{
		if (num1[a] == highest1)
		calBiggest(num1[a]);
		else
		cout << num1[a]<< endl;
	}
	cout << "The number of even numbers is "<<i<< endl;
	cout << "The average of even numbers is " << calAverage(num1, i)<< endl;
	cout << "---------------------------------" << endl;
	
	int highest2=-999999;
	for(int b=0; b<j; b++)
	{
		if (highest2<num2[b])
		highest2=num2[b];
	}
	
	cout << "The odd numbers are:\n";
	for(int b=0; b<j; b++)
	{
		if (num2[b] == highest2)
		calBiggest(num2[b]);
		else
		cout << num2[b] << endl;
	}
	cout << "The number of odd numbers is "<<j<< endl;
	cout << "The average of odd numbers is " << calAverage(num2, j)<< endl;
	
	inp.close();
	return 0;
}

double calAverage(int num[], int V)
{
	double sum=0;
	double average;
	for(int b=0; b<V; b++)
	{
		sum+=static_cast<double>(num[b]);
	}
	average=sum/(static_cast<double>(V));
	return average;
}

void calBiggest(int highest)
{
	cout <<"("<<highest<<")"<<endl;
}
