#include <bits/stdc++.h>
using namespace std;
int n, t, k, i, j, dari, ke, mid, x, last, ans;
int a[2000007];
bool yes[2000007];
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 1; i < n - 1; i++) {
    if (a[i - 1] != a[i] && a[i] != a[i + 1]) {
      yes[i] = true;
    }
  }
  x = 0;
  last = 0;
  for (i = 0; i < n; i++) {
    if (yes[i]) {
      if (x == 0) dari = i - 1;
      x++;
    } else if (x != 0) {
      ke = i;
      ans = max(ans, (ke - dari) / 2);
      mid = (ke + dari) / 2;
      for (j = dari; j <= mid; j++) a[j] = a[dari];
      for (j = mid + 1; j <= ke; j++) a[j] = a[ke];
      x = 0;
    }
  }
  printf("%d\n", ans);
  for (i = 0; i < n; i++) {
    printf("%d", a[i]);
    if (i == n - 1)
      printf("\n");
    else
      printf(" ");
  }
}
