1
& 0
 1
^ 123
 10
^ 218
& 150
| 935
& 61
| 588
& 897
| 411
| 584
^ 800
| 704
 3
& 1
& 3
& 5
 1
| 123
 1
^ 0
 1
| 1023
 3
& 242
^ 506
^ 522
 10
^ 160
& 1021
& 510
^ 470
& 1022
& 251
& 760
& 1016
| 772
| 515
 1
& 1023
 1
| 0
 2
| 56
^ 875
 1
^ 1023
 2
| 999
^ 689
 3
^ 125
^ 377
& 1019
 1
& 123

3
& 0
| 0
^ 0
 3
& 1023
| 0
^ 123
 3
& 763
| 763
^ 0
 3
& 1
| 0
^ 0
 3
& 1023
| 123
^ 0
 3
& 1023
| 0
^ 0
 3
& 1023
| 1023
^ 0
 3
& 1010
| 768
^ 240
 2
| 775
^ 112
 3
& 1023
| 0
^ 0
 3
& 1023
| 0
^ 0
 3
& 983
| 16
^ 835
 3
& 1023
| 0
^ 1023
 3
& 350
| 326
^ 16
 3
& 1019
| 0
^ 256
 3
& 123
| 0
^ 0

#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
int expo(int x, int y) {
  int res = 1;
  x = x % M;
  while (y > 0) {
    if (y & 1) res = (1ll * res * x) % M;
    y = y >> 1;
    x = (1ll * x * x) % M;
  }
  return res;
}
int ncr(int n, int r) {
  int res = 1;
  if (r > n - r) r = n - r;
  for (int i = 0; i < r; i++) {
    res *= n - i;
    res /= i + 1;
  }
  return res;
}
bool prime(long long n) {
  long long i;
  for (i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    int n, i, z;
    char ch;
    cin >> n;
    vector<pair<char, int>> v;
    for (i = 0; i < n; i++) {
      cin >> ch >> z;
      v.push_back({ch, z});
    }
    int a1[10] = {}, b1[10] = {}, a2 = 0, b2 = 1023;
    for (i = 0; i < n; i++) {
      if (v[i].first == '|') {
        a2 |= v[i].second;
        b2 |= v[i].second;
      } else if (v[i].first == '&') {
        a2 &= v[i].second;
        b2 &= v[i].second;
      } else {
        a2 ^= v[i].second;
        b2 ^= v[i].second;
      }
    }
    int k = 0;
    while (a2 != 0) {
      a1[k++] = (a2 % 2);
      a2 /= 2;
    }
    k = 0;
    while (b2 != 0) {
      b1[k++] = (b2 % 2);
      b2 /= 2;
    }
    int z1 = 0, z2 = 0, z3 = 0;
    for (i = 0; i < 10; i++) {
      if (a1[i] == 1 && b1[i] == 0) z1 += pow(2, i);
      if (a1[i] == 1 && b1[i] == 1) z2 += pow(2, i);
      if (!(a1[i] == 0 && b1[i] == 0)) z3 += pow(2, i);
    }
    cout << 3 << "\n";
    cout << "^ " << z1 << "\n";
    cout << "| " << z2 << "\n";
    cout << "& " << z3 << "\n";
  }
  return 0;
}
