#include <bits/stdc++.h>
int main() {
  short a[500001], b[500001];
  int i, j, k, l, m, n, x, y;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  a[0] = a[1];
  a[n + 1] = a[n];
  x = 1;
  y = 1;
  m = 0;
  for (i = 1; i <= n; i++) {
    if (a[i] == a[i + 1]) {
      y = i;
      if (a[x] == a[y]) {
        if (m < ((y - x) / 2)) m = (y - x) / 2;
        for (j = x; j <= y; j++) a[j] = a[x];
      } else {
        if (m < ((y - x) / 2)) m = (y - x) / 2;
        for (j = x; j <= (y - x) / 2 + x; j++) {
          a[j] = a[x];
        }
        for (j = (y - x) / 2 + x + 1; j <= y; j++) {
          a[j] = a[y];
        }
      }
      x = y + 1;
    } else
      continue;
  }
  printf("%d\n", m);
  for (i = 1; i <= n - 1; i++) printf("%d ", a[i]);
  printf("%d\n", a[n]);
  return (0);
}
