#CCBCHBAHAI0000087. Tìm số bị thiếu trong 0..n bằng seen[]
Tìm số bị thiếu trong 0..n bằng seen[]
Find the Missing Number in 0..n Using seen[]
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
You are given distinct integers chosen from
Exactly one value is missing. Find that value using presence marking.
Input
The first line contains . The second line contains distinct integers with .
Output
Print the unique missing integer .
Subtask
Subtask 1 (20 points): .
Subtask 2 (30 points): .
Subtask 3 (50 points): .
Example
Input
5
3 0 1 5 2
Output
4
Explanation
The result follows directly from the mathematical definition above.