#XSS202405. Find the Number (Hard)

Find the Number (Hard)

提示

$\color{red} \textbf{请注意此题不平凡的空间限制,超过空间限制可能导致系统返回 Runtime Error 的结果。}$

题目描述

给出长度为 nn 的数组 a1,a2,,ana_1, a_2, \dots, a_n,其中有且仅有两个数字只出现了一次,其他数字均出现了两次,请你找出这两个只出现一次的数字。

输入格式

第一行,一个整数 nn2n1062 \le n \le 10^6),保证 nn 为偶数。

第二行,nn 个整数表示 a1,a2,,ana_1, a_2, \dots, a_n1ai1091 \le a_i \le 10^{9})。

输出格式

一行两个整数,从小到大输出只出现一次的数字。

样例

6
1 2 3 3 4 4
1 2