CF525C.Ilya and Sticks

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of nn sticks and an instrument. Each stick is characterized by its length lil_{i} .

Ilya decided to make a rectangle from the sticks. And due to his whim, he decided to make rectangles in such a way that maximizes their total area. Each stick is used in making at most one rectangle, it is possible that some of sticks remain unused. Bending sticks is not allowed.

Sticks with lengths a1a_{1} , a2a_{2} , a3a_{3} and a4a_{4} can make a rectangle if the following properties are observed:

  • a1<=a2<=a3<=a4a_{1}<=a_{2}<=a_{3}<=a_{4}
  • a1=a2a_{1}=a_{2}
  • a3=a4a_{3}=a_{4}

A rectangle can be made of sticks with lengths of, for example, 3 3 3 33 3 3 3 or 2 2 4 42 2 4 4 . A rectangle cannot be made of, for example, sticks 5 5 5 75 5 5 7 .

Ilya also has an instrument which can reduce the length of the sticks. The sticks are made of a special material, so the length of each stick can be reduced by at most one. For example, a stick with length 55 can either stay at this length or be transformed into a stick of length 44 .

You have to answer the question — what maximum total area of the rectangles can Ilya get with a file if makes rectangles from the available sticks?

输入格式

The first line of the input contains a positive integer nn ( 1<=n<=1051<=n<=10^{5} ) — the number of the available sticks.

The second line of the input contains nn positive integers lil_{i} ( 2<=li<=1062<=l_{i}<=10^{6} ) — the lengths of the sticks.

输出格式

The first line of the output must contain a single non-negative integer — the maximum total area of the rectangles that Ilya can make from the available sticks.

输入输出样例

  • 输入#1

    4
    2 4 4 2
    

    输出#1

    8
    
  • 输入#2

    4
    2 2 3 5
    

    输出#2

    0
    
  • 输入#3

    4
    100003 100004 100005 100006
    

    输出#3

    10000800015
    
首页