#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int w[MAXN], num[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &w[i]);
  }
  int Max = 0;
  for (int i = 2; i <= n; ++i) {
    if (w[i] != w[i - 1] && w[i] != w[i + 1] && i != n) {
      num[i] = num[i - 1] + 1;
    } else {
      if (num[i - 1]) {
        Max = max(Max, (num[i - 1] + 1) / 2);
        if (num[i - 1] % 2 == 0) {
          for (int a = i - num[i - 1], b = i - 1; a < b; ++a, --b) {
            w[a] = !w[i];
            w[b] = w[i];
          }
        } else {
          for (int j = i - num[i - 1]; j < i; ++j) {
            w[j] = w[i];
          }
        }
      }
    }
  }
  printf("%d\n", Max);
  for (int i = 1; i <= n; ++i) {
    putchar(w[i] + '0');
    putchar(' ');
  }
  return 0;
}
