#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7, INF = 0x3f3f3f3f;
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int ma = 1;
  for (int i = 0; i < n; i++) {
    int j;
    for (j = i + 1; j < n; j++)
      if (a[j] == a[j - 1]) break;
    if (j - i >= 2)
      ma = max(ma, j - i);
    else
      continue;
    if ((j - i) % 2) {
      if (!a[i]) {
        for (int k = i + 1; k < j; k += 2) a[k] ^= 1;
      } else
        for (int k = i + 1; k < j; k += 2) a[k] ^= 1;
    } else {
      if (!a[i]) {
        for (int k = i; k < (j + i) / 2; k++) a[k] = 0;
        for (int k = (j + i) / 2; k < j; k++) a[k] = 1;
      } else {
        for (int k = i; k < (j + i) / 2; k++) a[k] = 1;
        for (int k = (j + i) / 2; k < j; k++) a[k] = 0;
      }
    }
    i = j - 1;
  }
  printf("%d\n", (ma - 1) / 2);
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
}
