#include <bits/stdc++.h>
using namespace std;
int mi(int a, int b) { return a < b ? a : b; }
int ma(int a, int b) { return a > b ? a : b; }
int n, a[500005], b[500005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int k = 1;
  int res = 0;
  while (1) {
    int kk = k;
    if (k == n) break;
    while (a[kk + 1] == a[k] && (kk + 1) <= n) kk++;
    for (int i = k; i <= kk; i++) b[i] = a[i];
    int k3 = kk;
    int nn = 0;
    while (a[k3 + 1] != a[k3] && k3 + 1 <= n) {
      k3++;
      nn++;
    }
    int k33 = k3;
    while (a[k33 + 1] == a[k3] && (k33 + 1) <= n) k33++;
    for (int i = k3; i <= k33; i++) b[i] = a[i];
    res = ma(res, (k3 - kk) / 2);
    int l = kk + 1, r = k3 - 1;
    if (l <= r) {
      while (l < r) {
        b[l] = b[l - 1];
        b[r] = b[r + 1];
        l++;
        r--;
      }
      int rr = a[l - 1] + a[l] + a[l + 1];
      int xx = (k3 - kk) / 2;
      if (xx % 2)
        b[l] = a[l] ^ 1;
      else
        b[l] = a[l];
    }
    k = k33;
  }
  cout << res << endl;
  for (int i = 1; i <= n; i++) {
    printf("%d", b[i]);
    if (i == n)
      printf("\n");
    else
      printf(" ");
  }
  return 0;
}
