409490: GYM103584 C Redwoods

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Redwoodstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Redwoods are known as one of the tallest species of trees, reaching heights of more than 300 feet! Thus, Johnny has decided that he wants to build a treehouse in the redwood near his house. However, he also doesn't want to be lonely!

Johnny has decided that he will let those in if they were able to solve the answer to a question that he has devised. He will give anyone who wants to enter the list of numbers ranging from 1 to $$$n$$$ but has removed one number from the list. The numbers can also appear in any order, but each number will only appear once. Since he chose the number to remove at random, he wants to know the mean of the list of numbers as well. Output the floor of the absolute difference between the missing number that Johnny has removed and the mean of the list.

Input

The first line will consist of an integer that represents $$$n$$$ ($$$1 \leq n \leq 10^5$$$). The next line will contain $$$n-1$$$ integers where each integer $$$a_i$$$ ($$$1 \leq a_i \leq n$$$) represents a value in the list that Johnny will provide those who want to enter the treehouse.

Output

Output the floor of the absolute difference between the missing number in the array and the mean of the list of numbers that Johnny has provided.

ExamplesInput
5
1 2 4 5
Output
0
Input
2
1
Output
1
Note

In the first test case, the missing number is 3. The average of the numbers is also 3, so we output 0.

In the second case, we are missing a 2. Since the average of the numbers is 1, we output 1.

加入题单

算法标签: