#include <bits/stdc++.h>
using namespace std;
bool a[1000000];
bool ans[1000000];
int main() {
  int n, maxn = 0, d;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    ans[i] = a[i];
    int j;
    for (j = i; j < n; j++)
      if (a[j] == a[j + 1]) break;
    d = j - i - 1;
    for (int k = i; k <= j; k++)
      if (k - i < j - k)
        ans[k] = a[i];
      else
        ans[k] = a[j];
    maxn = max(maxn, d);
    i = j;
  }
  printf("%d\n", maxn / 2 + maxn % 2);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
