#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:134217728")
using namespace std;
int a[1 << 19];
int b[1 << 19];
int dp[1 << 19];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  int res = 0;
  int i = 0;
  while (i < n) {
    int cnt = 1;
    int j = i;
    while (i + 1 < n && a[i] != a[i + 1]) {
      cnt++;
      i++;
    }
    res = max(res, (cnt - 1) / 2);
    if (cnt & 1) {
      for (int k = j; k < i; ++k) a[k] = a[j];
    } else {
      for (int k = 0; k < cnt / 2; ++k) {
        a[j + k] = a[j];
        a[j + cnt - k - 1] = 1 - a[j];
      }
    }
    i++;
  }
  printf("%d\n", res);
  for (int i = 0; i < n; ++i) printf("%d ", a[i]);
  printf("\n");
  return 0;
}
