#include <bits/stdc++.h>
template <typename T>
bool Chkmax(T &x, T y) {
  return x < y ? x = y, true : false;
}
template <typename T>
bool Chkmin(T &x, T y) {
  return y < x ? x = y, true : false;
}
const int MAXN = 5e5 + 1e5;
int ans;
int n;
int a[MAXN];
int b[MAXN];
void Solve() {
  for (int i = 1, _ = n; i <= _; ++i) b[i] = a[i];
  for (int i = 2, _ = n - 1; i <= _; ++i)
    if (a[i] != a[i - 1] && a[i] != a[i + 1]) b[i] = -1;
  int cnt = 0, fr = 1;
  for (int i = 1, _ = n; i <= _; ++i) {
    if (b[i] != -1) {
      cnt = i - fr - 1;
      Chkmax(ans, (cnt + 1) / 2);
      if (a[i] == a[fr])
        for (int j = fr + 1, _ = i - 1; j <= _; ++j) b[j] = a[i];
      else {
        for (int j = fr + 1, _ = fr + cnt / 2; j <= _; ++j) b[j] = a[fr];
        for (int j = fr + cnt / 2 + 1, _ = i - 1; j <= _; ++j) b[j] = a[i];
      }
      fr = i;
    }
  }
  printf("%d\n", ans);
  for (int i = 1, _ = n; i <= _; ++i) printf(i == n ? "%d\n" : "%d ", b[i]);
}
void Input() {
  scanf("%d", &n);
  for (int i = 1, _ = n; i <= _; ++i) scanf("%d", &a[i]);
}
int main() {
  if (fopen("A.in", "r") != NULL) {
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
  }
  Input();
  Solve();
  return 0;
}
