#include <bits/stdc++.h>
using namespace std;
int n, s[512345], sol, cnt, l, r;
void printseq() {
  for (int i = 0; i < n; i++) printf("%d ", s[i]);
  printf("\n");
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &s[i]);
  sol = 0;
  cnt = 0;
  for (int i = 1; i < n; i++) {
    if ((i == n - 1 && cnt > 0) || (s[i] == s[i - 1] || s[i] == s[i + 1])) {
      l = i - cnt;
      r = i - 1;
      if ((cnt) % 2 != 0) {
        for (int j = l; j <= r; j++) s[j] = s[l - 1];
      } else {
        for (int j = l; j <= (l + r) / 2; j++) s[j] = s[l - 1];
        for (int j = (l + r) / 2 + 1; j <= r; j++) s[j] = s[r + 1];
      }
      sol = max(sol, (cnt + 1) / 2);
      cnt = 0;
    } else {
      cnt++;
    }
  }
  printf("%d\n", sol);
  printseq();
}
