#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int N;
vector<int> vals;
deque<int> sol;
deque<int> calc(int v, int si) {
  deque<int> solu;
  if (si == 0) {
    return solu;
  } else if (si == 1) {
    solu.push_back(v);
    return solu;
  }
  int l = v, r = (v + si + 1) % 2;
  deque<int> dq = calc(v, si - 2);
  dq.push_front(l);
  dq.push_back(r);
  return dq;
}
void printD(deque<int> d) {
  for (int v : d) {
    printf("%d ", v);
  }
  printf("\n");
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    int v;
    scanf("%d", &v);
    vals.push_back(v);
  }
  int st = 0;
  int maxi = 0;
  for (int i = 0; i < N; i++) {
    int v = vals[i];
    if (i == N - 1 || vals[i + 1] == v) {
      deque<int> dq = calc(vals[st], i - st + 1);
      maxi = max(maxi, (i - st) / 2);
      for (int va : dq) {
        sol.push_back(va);
      }
      st = i + 1;
    }
  }
  printf("%d\n", maxi);
  printD(sol);
  return 0;
}
