#include
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int mask=0;
for (int i = 0; i < n; i++) {
mask^=a[i];
}
int result=mask;
int count=0;
if(!(mask&1)){ // I AM HAVING PROBLEM HERE UNDERSTANDING THIS LOOP WHAT IT DOES IF PROGRAM GO INSIDE THIS LOOP IN BHAIYA'S EXAMPLE THE PROGRAM DIDNT GO SO IT SATISIFIED COUNT ZERO CAN ANYONE TELL
count++;
mask>>=1;
}
mask = 1;
while(count--){
mask<<=1;
}
int num1 =0;
int num2 = 0;
for (int i = 0; i < n; i++) {
if((a[i]&mask)!=0){
num1^=a[i];
}
}
num2=result^num1;
if(num1<num2){
cout << num1<<" "<<num2 <<endl;
}else{
cout << num2<<" "<<num1 <<endl;
}
return 0;
}
// I AM HAVING PROBLEM HERE UNDERSTANDING LOOP(SEE CODE) WHAT IT DOES IF PROGRAM GO INSIDE THE LOOP IN BHAIYA’S EXAMPLE THE PROGRAM DIDNT GO SO IT SATISIFIED COUNT ZERO CAN ANYONE TELL WHEN THEIR IS COUNT++