Airfare Grants

면접 대비

시간 제한1초메모리 제한1024 MB

요약
N개의 항공권 가격이 주어질 때, 한 가격을 신고해 환급 한도를 그 절반으로 정한 뒤 항공권을 구매할 때의 최소 순비용을 구한다.
난이도

쉬움10점 중 2점

유형
구현, 그리디, 수학, 정렬
정답자
아직 제출이 없습니다

문제

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!

Here's how it works.

You have already obtained a list of available flights.

Among those options, you first report the price of any one potential flight. This determines the reimbursement limit of your trip; sponsors would pay you 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 will reimburse you the minimum of your actual cost and the reimbursement limit.

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

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

입력

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 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.

예제2

  1. 예제 1

    입력
    2
    150
    250
    
    예상 출력
    25
    
  2. 예제 2

    입력
    5
    200
    300
    150
    400
    500
    
    예상 출력
    0