#include <bits/stdc++.h>   using namespace std;   void printVector(vector<string> &v) {     for (auto x : v) cout << x <<   n ;   }   void printVector(vector<int> &v) {     for (auto x : v) cout << x <<    ;     cout <<   n ;   }   int main() {     cin.tie(0);     cout.tie(0);     ios::sync_with_stdio(0);     int t;     t = 1;     while (t--) {       int n, k, x;       cin >> n >> k >> x;       vector<int> freq(1024, 0);       vector<int> upd(1024, 0);       vector<int> calc(1024);       for (int i = 0; i < 1024; i++) {         calc[i] = i xor x;       }       for (int i = 0; i < n; i++) {         int a;         cin >> a;         freq[a]++;       }       for (int i = 0; i < k; i++) {         int sum = 0;         for (int j = 0; j < 1024; j++) {           int s = freq[j];           if (sum % 2 == 0) s++;           s /= 2;           upd[calc[j]] += s;           sum += freq[j];           freq[j] -= s;         }         for (int j = 0; j < 1024; j++) {           freq[j] += upd[j];           upd[j] = 0;         }       }       int mn, mx;       for (int j = 0; j < 1024; j++) {         if (freq[j] > 0) {           mn = j;           break;         }       }       for (int j = 1023; j >= 0; j--) {         if (freq[j] > 0) {           mx = j;           break;         }       }       cout << mx <<     << mn <<   n ;     }   }   