#include <bits/stdc++.h>   using namespace std;   int main() {     int a = 1023, b = 0, n, e;     char op;     cin >> n;     while (n--) {       cin >> op >> e;       if (op ==  | ) {         a |= e;         b |= e;       } else if (op ==  & ) {         a &= e;         b &= e;       } else if (op ==  ^ ) {         a ^= e;         b ^= e;       }     }     int ouxor = 0;     int ou = 0;     int exor = 0;     e = 0;     for (int i = 0; i < 10; i++) {       int num = 1 << i;       if ((a & num) && (b & num))         ou |= num;       else if ((b & num))         exor |= num;       else if (!(a & num) && !(b & num))         ouxor |= num;     }     int count = 0;     count += ouxor ? 2 : 0;     count += ou ? 1 : 0;     count += exor ? 1 : 0;     cout << count << endl;     if (ou) cout <<  |   << ou << endl;     if (ouxor) {       cout <<  |   << ouxor << endl;       cout <<  ^   << ouxor << endl;     }     if (exor) cout <<  ^   << exor << endl;   }   