#K50252. Find the Unique Integer

    ID: 28823 Type: Default 1000ms 256MiB

Find the Unique Integer

Find the Unique Integer

You are given an integer n and a list of 2n - 1 integers. Every integer from 1 to n appears exactly twice except for one unique integer which appears only once.

Your task is to write a program that finds and outputs that unique integer.

In mathematical terms, if the list L contains exactly two copies of every integer in \(\{1, 2, \ldots, n\}\) except for one integer \(x\) that appears only once, then find \(x\).

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  • The first line contains a single integer n (where \(n \ge 1\)).
  • The second line contains 2n - 1 space-separated integers, representing the list in which every integer between 1 and n appears exactly twice except one.

outputFormat

Output the unique integer that appears only once to standard output (stdout).

## sample
4
1 2 3 2 1 4 3
4