#include <bits/stdc++.h>
using namespace std;
const int maxN = 500005;
int n, top;
struct node {
  bool val;
  int num;
} s[3][maxN];
void input() {
  top = -1;
  int u;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &u);
    if (top == -1 || u != s[0][top].val) {
      top++;
      s[0][top].val = u;
      s[0][top].num = 1;
    } else
      s[0][top].num++;
  }
}
void work() {
  int run = 0, ttop = -1, from, cnt;
  for (int i = 0; i <= top; i++) {
    ttop++;
    s[1][ttop] = s[0][i];
    if (i < top - 1 && s[0][i + 1].num == 1) {
      from = i;
      i++;
      while (s[0][i].num == 1 && i < top) i++;
      if (s[0][from].val == s[0][i].val) {
        cnt = i - from + 1;
        ttop++;
        s[1][ttop].val = s[0][i].val;
        s[1][ttop].num = cnt - 2;
        run = max(run, cnt / 2);
      } else {
        cnt = i - from + 1;
        ttop++;
        s[1][ttop].val = s[0][from].val;
        s[1][ttop].num = cnt / 2 - 1;
        ttop++;
        s[1][ttop].val = s[0][i].val;
        s[1][ttop].num = cnt / 2 - 1;
        run = max(run, cnt / 2 - 1);
      }
      i--;
    }
  }
  printf("%d\n", run);
  bool flag = false;
  for (int i = 0; i <= top; ++i) {
    for (int j = 0; j < s[1][i].num; ++j) {
      if (flag) printf(" ");
      printf("%d", s[1][i].val);
      flag = true;
    }
  }
  printf("\n");
}
int main() {
  while (scanf("%d", &n) != EOF) {
    input();
    work();
  }
  return 0;
}
