Two Orphan Parts
Problem
On the night shift at a factory, a stamping machine fails and two parts lose their partners. The factory makes parts in matching pairs, and every part carries a serial number. Two parts in a pair carry the same serial number, and different pairs carry different numbers. The log now holds every serial number twice, except for two numbers that appear only once. The inspector needs those two numbers.
Find the two serial numbers that appear once.
Input
The first line has an integer n, the number of log entries. The second line has n integers. Every value appears exactly twice, except two different values that appear exactly once.
Output
Print the two lonely serial numbers in increasing order, separated by a space.
Constraints
- 2 ≤ n ≤ 150000, and
nis even - 0 ≤ serial number < 230
- The input always has exactly two values that appear once.
Notes
In the first example the serial numbers 4 and 2 each appear twice, while 9 and 7 each appear once. So the two lonely numbers are 7 and 9, printed in increasing order.