103171: [Atcoder]ABC317 B - MissingNo.

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

Description

Score : $200$ points

Problem Statement

Naohiro had $N+1$ consecutive integers, one of each, but he lost one of them.

The remaining $N$ integers are given in arbitrary order as $A_1,\ldots,A_N$. Find the lost integer.

The given input guarantees that the lost integer is uniquely determined.

Constraints

  • $2 \leq N \leq 100$
  • $1 \leq A_i \leq 1000$
  • All input values are integers.
  • The lost integer is uniquely determined.

Input

The input is given from Standard Input in the following format:

$N$
$A_1$ $A_2$ $\ldots$ $A_N$

Output

Print the answer.


Sample Input 1

3
2 3 5

Sample Output 1

4

Naohiro originally had four integers, $2,3,4,5$, then lost $4$, and now has $2,3,5$.

Print the lost integer, $4$.


Sample Input 2

8
3 1 4 5 9 2 6 8

Sample Output 2

7

Sample Input 3

16
152 153 154 147 148 149 158 159 160 155 156 157 144 145 146 150

Sample Output 3

151

Output

得分:200分

问题描述

Naohiro拥有$N+1$个连续的整数,但其中一个被他弄丢了。

剩下的$N$个整数以任意顺序给出,分别为$A_1,\ldots,A_N$。请找出丢失的整数。

给定的输入保证丢失的整数是唯一确定的。

限制条件

  • $2 \leq N \leq 100$
  • $1 \leq A_i \leq 1000$
  • 所有的输入值都是整数。
  • 丢失的整数是唯一确定的。

输入

输入将从标准输入按以下格式给出:

$N$
$A_1$ $A_2$ $\ldots$ $A_N$

输出

打印答案。


样例输入1

3
2 3 5

样例输出1

4

Naohiro原本拥有四个整数,$2,3,4,5$,然后弄丢了$4$,现在他拥有$2,3,5$。

打印丢失的整数,$4$。


样例输入2

8
3 1 4 5 9 2 6 8

样例输出2

7

样例输入3

16
152 153 154 147 148 149 158 159 160 155 156 157 144 145 146 150

样例输出3

151

HINT

连续的n个数中,缺失的是哪个?

加入题单

算法标签: