#include <bits/stdc++.h>
using namespace std;
const long long INFF = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
const int MOD = int(1e9) + 9;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const double OO = 1e20;
const int MAXN = 500050;
int a[MAXN];
bool v[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  a[0] = -1;
  a[n + 1] = -1;
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  a[0] = a[1];
  a[n + 1] = a[n];
  for (int i = 1; i <= n; ++i)
    if (a[i] != a[i - 1] && a[i] != a[i + 1]) v[i - 1] = v[i] = v[i + 1] = true;
  int st = 0, beg, en, ans = 0, mid;
  for (int i = 1; i <= n + 1; ++i) {
    if (!st && v[i]) {
      beg = i;
      st = 1;
    }
    if (st && (!v[i] || a[i] == a[i - 1])) {
      en = i;
      st = 0;
      ans = max(ans, (en - beg - 1) / 2);
      if ((en - beg) & 1) {
        for (int j = beg; j < en; ++j) a[j] = a[beg];
      } else {
        mid = (en + beg) / 2;
        for (int j = beg; j < mid; ++j) a[j] = a[beg];
        for (int j = mid; j < en; ++j) a[j] = a[beg] ^ 1;
      }
      if (v[i]) {
        st = 1;
        beg = i;
      }
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i < n; ++i) printf("%d ", a[i]);
  printf("%d\n", a[n]);
  return 0;
}
