#C13030. Find the Missing Number

    ID: 42524 Type: Default 1000ms 256MiB

Find the Missing Number

Find the Missing Number

Given an array of distinct integers containing numbers from (1) to (n) (where (n = |arr| + 1)) with exactly one number missing, your task is to find the missing number. The solution is based on the well-known formula for the sum of the first (n) natural numbers: (S = \frac{n(n+1)}{2}).

inputFormat

Input is provided via standard input (stdin) as a single line containing space-separated integers representing the elements of the array. The array contains (n-1) numbers and the complete range should be from (1) to (n).

outputFormat

Output the missing number via standard output (stdout).## sample

3 7 1 2 8 4 5
6