Account
GitHubFeedback
Drafts and results saved on this device
Submit on CSES.fi
CSES Problemset/Introductory Problems

Missing Number

#1083
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

Time limit:1.00 s
Memory limit:512 MB
Unsolved
Download Tests (.zip)

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

Input

The first input line contains an integer nn.

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

Output

Print the missing number.

Constraints
  • 2≤n≤2⋅1052 \le n \le 2 \cdot 10^5
Sample Test Cases (1)
Example 1ID: sample-1
Input
5
2 3 1 5
Expected Output
4
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 chars
Test Bench
Download .zip
Input (stdin)
5
2 3 1 5
Expected Output
4