#include <bits/stdc++.h>
using namespace std;
int g[1000000], h[1000000], p[1000000];
bool b[1000000];
int i, j, n, s;
inline int fastscanf() {
  int t = 0;
  char c = getchar();
  while (!((c > 47) && (c < 58))) c = getchar();
  while ((c > 47) && (c < 58)) t = t * 10 + c - 48, c = getchar();
  return t;
}
int main() {
  n = fastscanf();
  for (i = 1; i <= n; i++) g[i] = fastscanf();
  b[1] = true, b[n] = true;
  for (i = 2; i < n; i++)
    if ((g[i] == g[i - 1]) || (g[i] == g[i + 1])) b[i] = true;
  for (i = 1; i <= n; i++)
    if (!b[i])
      h[i] = h[i - 1] + 1, p[i] = p[i - 1];
    else {
      h[i] = 0, p[i] = i;
      if ((i > 1) && (!b[i - 1]))
        if (g[i] == g[p[i - 1]]) {
          s = max(s, (h[i - 1] + 1) / 2);
          for (j = p[i - 1] + 1; j < i; j++) g[j] = g[i];
        } else {
          s = max(s, h[i - 1] / 2);
          for (j = 1; j <= h[i - 1] / 2; j++) g[p[i - 1] + j] = g[p[i - 1]];
          for (j = h[i - 1] / 2 + 1; j <= h[i - 1]; j++) g[p[i - 1] + j] = g[i];
        }
    }
  printf("%d\n", s);
  for (i = 1; i <= n; i++)
    if (g[i])
      putchar('1'), putchar(' ');
    else
      putchar('0'), putchar(' ');
  return 0;
}
