#include <bits/stdc++.h>
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 5e5 + 5;
const double eps = 1e-9;
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a = 0, b = 1023;
  for (int i = 0; i < n; i++) {
    char c;
    int x;
    scanf(" %c", &c);
    scanf("%d", &x);
    if (c == '|') {
      a |= x;
      b |= x;
    } else if (c == '&') {
      a &= x;
      b &= x;
    } else {
      a ^= x;
      b ^= x;
    }
  }
  printf("2\n& %d\n^ %d\n", a ^ b, a);
  return 0;
}
