#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a[500005] = {}, b[500005], ans = 0;
  cin >> N;
  for (int i = 0; i < (N); i++) cin >> a[i];
  a[N] = a[N - 1];
  int st = -1;
  b[0] = a[0];
  b[N - 1] = a[N - 1];
  for (int i = 1; i < N; i++) {
    if (a[i - 1] == a[i] || a[i] == a[i + 1]) {
      b[i] = a[i];
      if (st > 0) {
        int count = 0;
        for (int k = 0; st + k < i - k; k++) {
          b[st + k] = a[st + k] ^ ((k + 1) % 2);
          b[i - k - 1] = a[i - k - 1] ^ ((k + 1) % 2);
          count++;
        }
        st = -1;
        ans = max(ans, count);
      }
    } else {
      if (st <= 0) st = i;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < (N); i++) cout << b[i] << " ";
  cout << endl;
  return 0;
}
