Under construction

Still being built. Things may change

Airfare Grants

Time limit1sMemory limit1024 MB

Summary
Given N flight prices, report the maximum price as the limit and buy the minimum, then output the net cost after the sponsors pay the lesser of the cost and half the limit.
Level

Easy1 of 10

Topics
Array, Sorting
Solved
No attempts yet

Problem

Congratulations! Your team has advanced to the next round of the International Cupcake Production Competition (ICPC)!

To participate in the competition, you are going to fly to Cupcake City from your hometown. The competition organizers have just shared good news: generous sponsors will support you with your flight ticket!

The process works as follows.

You have already obtained a list of available flights.

Among those options, you first report the price of any one potential flight. This sets the reimbursement limit for your trip. Sponsors pay up to half that price.

Next, you actually purchase your flight ticket. This flight may or may not be the same as the flight you report for the reimbursement limit.

Finally, you show the receipt of your purchase, and sponsors reimburse you the minimum of your actual cost and the reimbursement limit.

Now, you want to figure out your minimum possible net cost, meaning the price you pay minus the amount you get reimbursed.

Naturally, you report the price of the most expensive flight ticket and buy the cheapest flight ticket.

Input

The first line of input is an integer, NN (1≤N≤501 \leq N \leq 50), the number of available flights.

Each of the next NN lines contains an integer PP (10≤P≤10510 \leq P \leq 10^5), which is the price of a flight ticket from your hometown to Cupcake City, in dollars. It is guaranteed that PP is a multiple of 1010.

Output

Output a single integer, the minimum amount, in dollars, that you have to pay for a flight ticket, excluding the amount of travel support from sponsors.

Examples2

  1. Example 1

    Input
    2
    150
    250
    
    Expected output
    25
    
  2. Example 2

    Input
    5
    200
    300
    150
    400
    500
    
    Expected output
    0