#include <bits/stdc++.h>
using namespace std;
int n, i, a[500005];
int f(int l, int r) {
  if ((r - l + 1) % 2 == 0) {
    int st = a[l];
    int ed = a[r];
    for (int ii = l; ii <= (l + r) / 2; ii++) a[ii] = ed;
    for (int ii = (l + r) / 2 + 1; ii <= r; ii++) a[ii] = st;
  } else {
    int st = 1 - a[l];
    for (int ii = l; ii <= r; ii++) a[ii] = st;
  }
  return (r - l + 2) / 2;
}
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  int lt = 1;
  int res = 0;
  for (i = 0; i < n; i++) {
    if (i == n - 1 || a[i] == a[i + 1]) {
      res = max(res, f(lt, i - 1));
      lt = i + 2;
    }
  }
  printf("%d\n", res);
  for (i = 0; i < n; i++) {
    if (i == 0)
      printf("%d", a[i]);
    else
      printf(" %d", a[i]);
  }
  printf("\n");
}
