#include <bits/stdc++.h>
using namespace std;
int total[500020], what[500020], n, idx, ans;
int main() {
  total[0] = 1;
  scanf("%d%d", &n, &what[0]);
  for (int i = 1, tmp; i < n; i++) {
    scanf("%d", &tmp);
    if (tmp != what[idx]) {
      total[++idx]++;
      if (what[idx - 1] == 0)
        what[idx] = 1;
      else
        what[idx] = 0;
    } else
      total[idx]++;
  }
  for (int i = 1; i < idx; i++) {
    if (total[i] == 1) {
      int j = i, k;
      while (total[j] == 1 && j < idx) {
        total[j] = 0;
        j++;
      }
      k = j - i;
      if (k % 2) {
        ans = max(ans, k / 2 + 1);
        total[i] = k;
        what[i] = what[i - 1];
      } else {
        ans = max(ans, k / 2);
        total[i] = k / 2;
        what[i] = what[i - 1];
        what[j - 1] = what[j];
        total[j - 1] = k / 2;
      }
      i = j - 1;
    }
  }
  printf("%d\n", ans);
  for (int i = 0; i <= idx; i++) {
    while (total[i]--) printf("%d ", what[i]);
  }
  puts("");
  return 0;
}
