#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <class T>
inline void scan_d(T &ret) {
  char c;
  int flag = 0;
  ret = 0;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-') {
    flag = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') ret = ret * 10 + (c - '0'), c = getchar();
  if (flag) ret = -ret;
}
int a[500005], flag[500005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    flag[i] = 0;
  }
  int ans = 0;
  for (int i = n - 1; i >= 2; i--) {
    if (a[i - 1] == a[i + 1] && a[i] != a[i - 1]) {
      flag[i] = flag[i + 1] + 1;
      ans = max(ans, flag[i]);
    }
  }
  printf("%d\n", ans / 2 + (ans % 2 ? 1 : 0));
  printf("%d", a[1]);
  for (int i = 2; i <= n - 1; i++) {
    if (flag[i] == 0)
      printf(" %d", a[i]);
    else if (flag[i] + 1 != flag[i - 1]) {
      int p = a[i];
      if (flag[i] & 1) {
        for (int j = 1; j <= flag[i]; j++) printf(" %d", p ^ 1);
      } else {
        for (int j = 1; j <= flag[i]; j++)
          printf(" %d", j <= flag[i] / 2 ? p ^ 1 : p);
      }
    }
  }
  printf(" %d\n", a[n]);
  return 0;
}
