#P8598. Find the Missing and Duplicate Ticket ID

    ID: 21764 Type: Default 1000ms 256MiB

Find the Missing and Duplicate Ticket ID

Find the Missing and Duplicate Ticket ID

Each ticket has a unique ID. All ticket IDs for the year form a consecutive sequence, but the starting ID is randomly chosen. Due to a data entry error, one ticket ID is missing and another ticket ID appears twice.

Your task is to write a program to determine the missing ID and the duplicate ID.

Note: The missing ticket ID will never be the smallest or the largest in the sequence.

inputFormat

The input begins with an integer n indicating the number of ticket records. The second line contains n space-separated integers representing the ticket IDs. The IDs should form a consecutive sequence except that one ID is missing and another ID is duplicated.

outputFormat

Output two integers separated by a space: the missing ticket ID and the duplicate ticket ID.

sample

5
101 102 104 104 105
103 104