process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {
    var n = parseInt(input[0], 10);
    var values = input[1].split(' ');
    var a = new Array(n);
    var i = 0;
    var side = [0, 0];
    var prev = 0;
    var area = 0; 

    for (i = 0; i < n; i++) {
        a[i] = parseInt(values[i], 10);
    }

    a.sort(function(a, b) {
        if (a > b) {
            return -1;
        }
        else if (a < b) {
            return 1;
        }
        else {
            return 0;
        }
    });
    

    for (i = 0; i < n; i++) {

        if (prev === a[i]) {
            if (side[0] > 0) {
                side[1] = a[i];
                break;
            }
            else {
                side[0] = a[i];
                prev = 0;
            }
        }
        else {
            prev = a[i];
        }
    }

    area = side[0] * side[1];
    console.log(area);
}

