#include <bits/stdc++.h>
using namespace std;
const int N = 500010;
int n, a[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int i = 1, id = 0, from, last = -1, cnt = 0, maxcnt = 0;
  for (int i = 1; i < n; i++) {
    if (a[id] == a[i] && a[i - 1] == 1 - a[id]) {
      if (!cnt) {
        from = i - 1;
      }
      cnt++;
      last = i;
      maxcnt = max(maxcnt, cnt);
    } else if (a[i] == a[i - 1] || i == n - 1) {
      if (cnt) {
        for (int j = from; j < i; j++) {
          a[j] = j - from >= (i - from) >> 1 ? a[i] : a[id];
        }
        cnt = 0;
      }
      id = i;
    }
  }
  if (cnt) {
    for (int j = from; j < n; j++) {
      a[j] = j - from > (n - from) >> 1 ? a[id] : a[n - 1];
    }
  }
  printf("%d\n", maxcnt);
  for (int i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
  puts("");
  return 0;
}
