#include <bits/stdc++.h>
using namespace std;
const int Maxn = 5100000;
int s[Maxn], n;
int _max(int x, int y) { return x > y ? x : y; }
int main() {
  int i, j, k;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &s[i]);
  int ans = 0;
  int p;
  for (i = 2; i < n; i++) {
    if (s[i] != s[i - 1] && s[i] != s[i + 1]) {
      k = 0;
      p = i;
      while (s[i] != s[i - 1] && s[i] != s[i + 1] && i < n) {
        k++;
        i++;
      }
      if (k % 2 == 0) {
        for (j = p; j <= p + k / 2 - 1; j++) s[j] = s[p - 1];
        for (j = p + k / 2; j <= p + k - 1; j++) s[j] = s[p + k];
      } else {
        for (j = p; j <= p + k - 1; j++) s[j] = s[p - 1];
      }
      ans = _max(ans, (k + 1) / 2);
    }
  }
  printf("%d\n", ans);
  for (i = 1; i < n; i++) printf("%d ", s[i]);
  printf("%d\n", s[n]);
  return 0;
}
