Which is missing? P89851


Statement
 

pdf   zip

html

Write a program that reads sequences with all the numbers between 1 and n but one, and tells which one is missing.

Input

Input consists of several sequences. Every sequence begins with a number n between 1 and 104 followed by n − 1 natural numbers. Every number between 1 and n appears exactly once, except one of them, which is missing.

Output

For every sequence, print the missing number.

Public test cases
  • Input

    5   3 2 1 5
    2   1
    10  5 4 6 7 1 2 9 10 8
    

    Output

    4
    2
    3
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java Python