#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
int a[N], b[N];
int deal(int L, int R) {
  int k = R - L + 1;
  if (k % 2)
    for (int i = L; i <= R; i++) b[i] = a[L];
  else {
    for (int i = L; i < L + (k / 2); i++) b[i] = a[L];
    for (int i = L + (k / 2); i <= R; i++) b[i] = a[R];
  }
  return (k - 1) / 2;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int L = 1, ans = 0;
  b[1] = a[1], b[n] = a[n], a[n + 1] = a[n];
  for (int i = 2; i <= n + 1; i++)
    if (a[i] == a[i - 1]) {
      ans = max(ans, deal(L, i - 1));
      L = i;
    }
  printf("%d\n%d", ans, b[1]);
  for (int i = 2; i <= n; i++) printf(" %d", b[i]);
  return 0;
}
