#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
int n, a[maxn], Ans = 0, cnt[maxn];
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 2; i < n; i++)
    if ((a[i - 1] ^ a[i]) && (a[i] ^ a[i + 1])) cnt[i] = 1;
  for (i = 2; i < n; i++)
    if (cnt[i]) {
      cnt[i] = cnt[i - 1] + 1;
      if (!cnt[i + 1]) {
        int L = i - cnt[i] + 1, R = i, sz = R - L + 2;
        Ans = max(Ans, sz / 2);
        if (sz & 1) {
          while (L < R) a[L] = a[L - 1], a[R] = a[R + 1], L++, R--;
        } else
          for (j = L; j <= R; j++) a[j] = a[j - 1];
      }
    }
  printf("%d\n", Ans);
  for (i = 1; i <= n; i++) printf("%d ", a[i]);
  printf("\n");
}
