#include <bits/stdc++.h>
using namespace std;
const int maxn = 500010;
int a[maxn], n, t, b[maxn], sum[maxn];
void update(int i, int l) {
  t = max(t, (l + 1) / 2);
  if (l % 2 == 1)
    for (int j = i - l; j <= i - 1; j++) a[j] = a[i];
  else {
    for (int j = i - l; j <= i - l / 2 - 1; j++) a[j] = a[i] ^ 1;
    for (int j = i - l / 2; j <= i - 1; j++) a[j] = a[i];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int l = 0;
  for (int i = 2; i < n; i++) {
    if (a[i] != a[i + 1] && a[i] != a[i - 1])
      l++;
    else {
      update(i, l);
      l = 0;
    }
  }
  update(n, l);
  printf("%d\n", t);
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  printf("\n");
  return 0;
}
