#include <bits/stdc++.h>
using namespace std;
int A[500005];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++) scanf("%d", A + i);
    int pos = 1;
    int ans = 0;
    while (pos < n) {
      while (pos < n && A[pos] == A[pos - 1]) pos++;
      if (pos >= n) break;
      int pos1 = pos;
      while (pos1 < n && A[pos1] != A[pos1 - 1]) pos1++;
      int cnt = (pos1 - pos - 1 + 1) / 2;
      ans = max(cnt, ans);
      int i = pos, j = pos1 - 2;
      while (i <= j) {
        A[i] = !A[i];
        if (i != j) A[j] = !A[j];
        i += 2;
        j -= 2;
      }
      pos = pos1;
    }
    printf("%d\n", ans);
    for (int i = 0; i < n - 1; i++) printf("%d ", A[i]);
    printf("%d\n", A[n - 1]);
  }
  return 0;
}
