#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, z, k, w;
int A[500005];
bool B[500005];
int L[500005], R[500005];
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) scanf("%d", &A[i]);
  for (int i = (1); i < (n - 1); i++) {
    if (A[i] != A[i - 1] && A[i] != A[i + 1]) B[i] = 1;
  }
  for (int i = (0); i < (n - 1); i++) {
    if (B[i] == 0)
      x = i;
    else
      L[i] = x;
  }
  for (int i = (n - 1); i >= (0); i--) {
    if (B[i] == 0)
      x = i;
    else
      R[i] = x;
  }
  for (int i = (1); i < (n - 1); i++) {
    if (B[i] == 1) {
      if (i - L[i] <= R[i] - i) {
        A[i] = A[L[i]];
        w = max(w, i - L[i]);
      } else {
        A[i] = A[R[i]];
        w = max(w, R[i] - i);
      }
    }
  }
  printf("%d\n", w);
  for (int i = (0); i < (n); i++)
    if (i != n - 1)
      printf("%d ", A[i]);
    else
      printf("%d\n", A[i]);
  return 0;
}
