Problems > Two Lonely Numbers

Two Lonely Numbers

Difficulty: 1600 3000 ms 128 MB

bitwise

Every value appears exactly twice except two distinct values that appear once each. Print them in increasing order.

Input: the first line has N (even); the second line has N positive integers.

Output: the two singleton values, ascending.

Constraints:

  • 2 ≤ N ≤ 105
  • 1 ≤ ai ≤ 106

Sample Tests

Input 1
4
1 2 1 3
Output 1
2 3
Input 2
2
5 9
Output 2
5 9

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.