#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int res = 0;
  int neg;
  while (true) {
    char ch = getchar();
    if (ch >= '0' && ch <= '9' || ch == '-') {
      if (ch == '-')
        neg = -1;
      else
        neg = 1, res = ch - '0';
      break;
    }
  }
  while (true) {
    char ch = getchar();
    if (ch >= '0' && ch <= '9')
      res *= 10, res += ch - '0';
    else
      break;
  }
  return res * neg;
}
const int maxn = 500020;
const int maxm = 1000020;
const int MOd = 1e3;
int a, ar[maxn];
int main() {
  scanf("%d", &a);
  for (int i = 1; i <= a; i++) scanf("%d", &ar[i]);
  int ans = 0;
  for (int i = 1; i <= a;) {
    int j = i;
    while (j <= a && ar[j] == (((j - i) & 1) ^ ar[i])) j++;
    ans = max(ans, ((j - i + 1) / 2 - 1));
    if ((j - i) & 1) {
      for (int k = i; k < j; k++) ar[k] = ar[i];
    } else {
      for (int k = i; k < j; k++) {
        if (k < (i + j) / 2)
          ar[k] = ar[i];
        else
          ar[k] = ar[i] ^ 1;
      }
    }
    i = j;
  }
  printf("%d\n", ans);
  for (int i = 1; i <= a; i++) printf("%d ", ar[i]);
  printf("\n");
  return 0;
}
