6677.Missing Number

Time Limit: 1s Memory Limit: 512MB

You are given all numbers between $1,2,\ldots,n$ except one. Your task is to find the missing number.

Input Format(From the terminal/stdin)

The first input line contains an integer $n$ .

The second line contains $n-1$ numbers. Each number is distinct and between $1$ and $n$ (inclusive).

  • $2 \le n \le 2 \cdot 10^5$

Output Format(To the terminal/stdout)

Print the missing number.

Sample Input

Copy
5
2 3 1 5
 \n
 · · · \n

Sample Output

Copy
4
 \n
Source: CSES, Introductory Problems, 1083

Submit

请先 登录

© 2025 FAQs