#include <bits/stdc++.h>
using namespace std;
int a[500005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int answer = 0, t = 0, pre = 2;
  for (int i = 2; i < n; i++) {
    if (a[i] == a[i - 1] || a[i + 1] == a[i]) {
      if (t == 0) continue;
      int num = 0;
      for (int j = pre, k = i - 1; j <= k; j++, k--) {
        num++;
        if (num & 1) {
          if (j != k)
            a[j] = !a[j], a[k] = !a[k];
          else
            a[j] = !a[j];
        }
      }
      answer = max(answer, num);
      t = 0;
    } else {
      if (t == 0) pre = i;
      t++;
    }
  }
  int num = 0;
  if (t)
    for (int j = pre, k = n - 1; j <= k; j++, k--) {
      num++;
      if (num & 1) {
        if (j != k)
          a[j] = !a[j], a[k] = !a[k];
        else
          a[j] = !a[j];
      }
    }
  answer = max(answer, num);
  printf("%d\n", answer);
  for (int i = 1; i <= n; i++) printf("%d%c", a[i], i == n ? '\n' : ' ');
}
