module app;

import std.stdio;
import std.algorithm;
import std.range;
import std.array;
import std.string;
import std.conv;

void main(){
    readln;
    auto sticks = readln.chop.split.map!(to!int).array.sort.array;
    auto against_sticks = get_against_sticks(sticks);
    int answer;
    if(against_sticks.length >= 2){
        int[] areas;
        foreach(i, w; against_sticks) {
            areas ~= against_sticks[i+1..$].map!((h) => h * w).array;
        }
        answer = areas.reduce!((a,b){
            if(a > b){
                return a;
            }else{
                return b;
            }
        });
    }else{
        answer = 0;
    }
    
    writeln(answer);
}

int[] get_against_sticks(int[] sticks){
    int pre = 0;
    int after = 1;
    int[] sub(int[] res ,int pre_, int after_){
        if(after_ >= sticks.length){
            return res;
        }else{
            if(sticks[pre_] == sticks[after_]){
                return sub(res ~ sticks[pre_], pre_+2, after_+2);
            }else{
                return sub(res, pre_+1, after_+1);
            }
        }
    }
    if(sticks.length >= 4){
        return sub([], pre, after);
    }else{
        return [];
    }
}