#include <bits/stdc++.h>
using namespace std;
char A[500005];
bool check(int i) {
  char B[4] = {A[i - 1], A[i], A[i + 1]};
  sort(B, B + 3);
  return B[1] == A[i];
}
int main() {
  int n, i, x;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &A[i]);
  int ans = 0;
  for (i = 2; i < n; i++) {
    if (!check(i)) {
      int cnt[2] = {0}, j = i;
      x = A[j];
      while (j < n && !check(j)) {
        cnt[!A[j]]++;
        j++;
      }
      if (cnt[0] == cnt[1]) {
        ans = max(ans, cnt[0]);
        for (int k = i; k <= cnt[0] + i - 1; k++) A[k] = !x;
        for (int k = cnt[0] + i; k < j; k++) A[k] = x;
      } else if (cnt[0] > cnt[1]) {
        ans = max(ans, cnt[0]);
        for (int k = i; k < j; k++) A[k] = 0;
      } else {
        ans = max(ans, cnt[1]);
        for (int k = i; k < j; k++) A[k] = 1;
      }
      i = j - 1;
    }
  }
  printf("%d\n", ans);
  for (i = 1; i <= n; i++) printf("%d ", A[i]);
  return 0;
}
