#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void smax(T &x, T y) {
  x = max((x), (y));
}
template <class T>
inline void smin(T &x, T y) {
  x = min((x), (y));
}
const int MOD = 1e9 + 7;
const int SIZE = 5 * 1e5 + 10;
const int INF = 0x3f3f3f3f;
int n, A[SIZE];
int main() {
  if (0) {
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
  }
  while (scanf("%d", &(n)) == 1) {
    for (int i = 0; i < (n); ++i) scanf("%d", &(A[i]));
    vector<pair<pair<int, int>, int> > alts;
    for (int i = (1); i < (n - 1); ++i) {
      if (A[i] != A[i - 1] && A[i] != A[i + 1]) {
        int j = i;
        while (j < n - 1 && A[j] != A[j - 1] && A[j] != A[j + 1]) {
          j++;
        }
        alts.push_back(make_pair(make_pair(i, j - 1), A[i]));
        i = j;
      }
    }
    vector<pair<pair<int, int>, int> > tmp;
    int cnt = 0;
    while (((int)(alts).size()) > 0) {
      tmp.clear();
      for (int i = 0; i < (((int)(alts).size())); ++i) {
        int a = alts[i].first.first;
        int b = alts[i].first.second;
        int st = alts[i].second;
        int ed = (b - a + 1) & 1 ? st : st ^ 1;
        A[a] = st ^ 1;
        A[b] = ed ^ 1;
        int nxa = a + 1;
        int nxb = b - 1;
        if (nxa <= nxb) {
          tmp.push_back(make_pair(make_pair(nxa, nxb), st));
        }
      }
      alts = tmp;
      cnt++;
    }
    printf("%d\n", cnt);
    for (int i = 0; i < (n); ++i) printf("%d%c", A[i], i == n - 1 ? '\n' : ' ');
  }
  return 0;
}
