#include <bits/stdc++.h>
using namespace std;
int n, s[1000005];
void init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &s[i]);
  s[0] = s[1];
  s[n + 1] = s[n];
  s[n + 2] = 1 - s[n];
}
int x, y;
int med(int a, int b, int c) {
  x = y = 0;
  a == 0 ? x++ : y++;
  b == 0 ? x++ : y++;
  c == 0 ? x++ : y++;
  return y > 1;
}
vector<pair<int, int> > v;
void process() {
  int ans = 0;
  int st = 0, vl = s[0];
  for (int i = 1; i <= n + 2; i++) {
    if (s[i] == vl)
      ;
    else {
      if (st < i - 1) v.emplace_back(st, i - 1);
      st = i, vl = s[i];
    }
  }
  for (int i = 1; i < (int)v.size(); i++) {
    int l = v[i - 1].second, r = v[i].first;
    if (s[l] == s[r]) {
      int len = r - l;
      ans = max(ans, len / 2);
      for (int j = l + 1; j < r; j++) s[j] = s[l];
    } else {
      int len = r - l - 1;
      len /= 2;
      ans = max(ans, len);
      for (int j = l + 1; j < l + len + 1; j++) s[j] = s[l];
      for (int j = l + len + 1; j < r; j++) s[j] = s[r];
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) printf("%d%c", s[i], " \n"[i == n]);
}
int main() {
  init();
  process();
  return 0;
}
