#include <iostream>
#include <vector>
#include <iterator>
#include <set>
#include <bits/stdc++.h>

using namespace std;

vector<int> List_of_Paired_Numbers;

void FindPair(vector<int> Arr,int Size){

    int tempArr[Size];
    for(int i = 0;i < Size;i++){

        tempArr[i] = Arr[i];

    }
    for(int i = 0;i < Size;i++){

        for(int j = i + 1;j < Size;j++){

            if(Arr[i] == tempArr[j]){

                List_of_Paired_Numbers.push_back(Arr[i]);
                tempArr[j] = 0;
                tempArr[i] = 0;
                Arr[j] = 0;
                Arr[i] = 0;

            }

        }

    }

}

int main(){

    int StickCount;
    vector<int> StickLength;

    cin >> StickCount;
    for(int i = 0;i < StickCount;i++){
        int tempLength;
        cin >> tempLength;
        StickLength.push_back(tempLength);

    }
    FindPair(StickLength,StickCount);

    if(List_of_Paired_Numbers.size() == 0){

        printf("0\nNo rectangle can be formed");

    }else{

        int* tempSide1 = &*max_element(List_of_Paired_Numbers.begin(),List_of_Paired_Numbers.end());
        int Side1 = *tempSide1;
        *tempSide1 = 0;
        int *tempSide2 = &*max_element(List_of_Paired_Numbers.begin(),List_of_Paired_Numbers.end());
        int Side2 = *tempSide2;
        *tempSide2 = 0;

        printf("%d\n",Side1*Side2);
        printf("%d x %d rectangle can be formed",Side1,Side2);

    }

}
