inlineintread(){ int r = 0,w = 1; char c = getchar(); while (c < '0' || c > '9'){ if (c == '-') w = -1; c = getchar(); } while (c >= '0' && c <= '9'){ r = (r << 3) + (r << 1) + (c ^ 48); c = getchar(); } return r * w; }
intmain(){ n = read(); for (re int i = 1;i <= n;i++){ arr[i] = read() % 3; num += (!arr[i]); } if (num * 2 >= n){ int cnt = 0; puts("2"); for (re int i = 1;i <= n;i++){ if (!arr[i]){ if (cnt < n / 2) putchar('0'); elseputchar('1'); cnt++; } elseputchar('1'); } } else{ int cnt = 0; puts("0"); for (re int i = 1;i <= n;i++){ if (!arr[i]) putchar('0'); else{ if (cnt + num < n / 2) putchar('0'); elseputchar('1'); cnt++; } } } return0; }