#include <bits/stdc++.h>
using namespace std;
int a[500010], f[500010], n, ans, s;
int l, r;
template <typename T>
void read(T &s) {
  char ch(0);
  bool f(0);
  do ch = getchar();
  while ((ch > '9' || ch < '0') && ch != '-');
  if (ch == '-') f = 1, ch = getchar();
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  if (f) s = -s;
}
template <typename T>
void writ(T x) {
  if (x < 0) {
    putchar('-');
    writ(-x);
  } else {
    if (x > 9) writ(x / 10);
    putchar(x % 10 + 48);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  f[1] = f[n] = 1;
  for (int i = 2; i <= n; i++)
    if (a[i] == a[i - 1]) f[i] = f[i - 1] = 1;
  for (int i = 2; i <= n; i++) {
    if (f[i]) {
      if (!f[i - 1]) {
        r = i - 1;
        ans = max((r - l + 2) / 2, ans);
        while (l <= r) a[l] = a[l - 1], a[r] = a[r + 1], l++, r--;
      }
      l = 0;
    } else if (!l)
      l = i;
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  return 0;
}
