#CCBCHBAHAI0000180. Số bị thiếu (Missing Number)
Số bị thiếu (Missing Number)
Missing Number
Source: CSES
Version: Phuoc Hung OJ Extended
Problem
You are given an integer . Exactly one number from is missing. The input contains the other pairwise distinct numbers.
Find the missing number.
For Chapter 32, the primary solution uses a presence array: mark every value that appears, then find the unmarked value.
Input
- The first line contains .
- The second line contains pairwise distinct integers from .
Output
Print the unique missing number.
Subtasks
Subtask 1 (20 points): ; the given numbers are pairwise distinct and lie in .
Subtask 2 (30 points): ; the given numbers are pairwise distinct and lie in .
Subtask 3 (50 points): ; the given numbers are pairwise distinct and lie in .
Example
Input
5
2 3 1 5
Output
4
Explanation
Among {1,2,3,4,5}, only 4 is absent.