#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
const int INF = (int)1.01e9;
const long double EPS = 1e-9;
void precalc() {}
const int maxn = (int)5e5 + 10;
int a[maxn];
int n;
bool read() {
  if (scanf("%d", &n) < 1) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i + 1);
  }
  n += 2;
  a[0] = a[1];
  a[n - 1] = a[n - 2];
  return 1;
}
void solve() {
  int last = -1;
  int res = 0;
  for (int i = 0; i < n;) {
    int i0 = i;
    while (i < n && a[i] == a[i0]) {
      ++i;
    }
    if (i - i0 >= 2) {
      if (last != -1) {
        int cnt = i0 - last;
        res = max(res, (cnt + 1) / 2);
        for (int j = 0; j < (cnt + 1) / 2; ++j) {
          a[last + j] = a[last - 1];
          a[i0 - j - 1] = a[i0];
        }
      }
      last = i;
    } else {
      assert(last != -1);
    }
  }
  assert(last == n);
  printf("%d\n", res);
  for (int i = 1; i < n - 1; ++i) {
    printf("%d%c", a[i], " \n"[i == n - 2]);
  }
}
int main() {
  srand(rdtsc());
  precalc();
  while (1) {
    if (!read()) {
      break;
    }
    solve();
  }
  return 0;
}
