#include <bits/stdc++.h>   using namespace std;   int n, x[500005];   char c[500005];   int a[20];   int q, w, e;   int main() {     cin.tie(0);     cout.tie(0);     ios_base::sync_with_stdio(false);     cin >> n;     for (int i = 0; i < 10; i++) a[i] = 2;     for (int i = 0; i < n; i++) {       cin >> c[i] >> x[i];     }     for (int i = 0; i < 10; i++) {       int k = (1 << i);       for (int j = 0; j < n; j++) {         if (c[j] ==  | ) {           if (x[j] & k) {             a[i] = 1;           }         } else if (c[j] ==  & ) {           if (!(x[j] & k)) {             a[i] = 0;           }         } else {           if (x[j] & k) {             if (a[i] == 0)               a[i] = 1;             else if (a[i] == 1)               a[i] = 0;             else if (a[i] == 2)               a[i] = 3;             else               a[i] = 2;           }         }       }     }     for (int i = 0; i < 10; i++) {       if (a[i] != 0) q += (1 << i);       if (a[i] == 3) w += (1 << i);       if (a[i] == 1) e += (1 << i);     }     cout <<  3 n ;     cout <<  &   << q <<   n ;     cout <<  ^   << w <<   n ;     cout <<  |   << e <<   n ;     return 0;   }   