#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int bit_state[12];
char c[500005];
int a[500005];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c[i] >> a[i];
  }
  for (int bit = 0; bit < 10; bit++) {
    for (int i = 0; i < n; i++) {
      if (c[i] == '|') {
        if (a[i] & (1 << (bit))) {
          bit_state[bit] = 2;
        }
      } else if (c[i] == '&') {
        if ((a[i] & (1 << bit)) == 0) {
          bit_state[bit] = 3;
        }
      } else {
        if (a[i] & (1 << bit)) {
          if (bit_state[bit] == 2)
            bit_state[bit] = 3;
          else if (bit_state[bit] == 3)
            bit_state[bit] = 2;
          else if (bit_state[bit] == 0)
            bit_state[bit] = 1;
          else if (bit_state[bit] == 1)
            bit_state[bit] = 0;
        }
      }
    }
  }
  cout << "3" << endl;
  int x = 0;
  for (int bit = 0; bit < 10; bit++) {
    if (bit_state[bit] == 1) x += (1 << bit);
  }
  cout << "^ " << x << endl;
  x = 0;
  for (int bit = 0; bit < 10; bit++) {
    if (bit_state[bit] != 3) x += (1 << bit);
  }
  cout << "& " << x << endl;
  x = 0;
  for (int bit = 0; bit < 10; bit++) {
    if (bit_state[bit] == 2) x += (1 << bit);
  }
  cout << "| " << x << endl;
  return 0;
}
