#include <bits/stdc++.h>
using namespace std;
int n;
int arr[600000];
int ans;
void JustDoIt(int L, int R) {
  int cnt = 0;
  bool Start = 0;
  while (L <= R) {
    ++cnt;
    arr[L] ^= Start;
    if (R != L) arr[R] ^= Start;
    Start ^= 1;
    ++L;
    --R;
  }
  ans = max(ans, cnt - 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i < n + 1; ++i) cin >> arr[i];
  arr[0] = arr[1];
  arr[n + 1] = arr[n];
  int L = 1, R = 1;
  for (int i = 1; i < n + 2; ++i) {
    if (arr[i] == arr[i - 1]) {
      if (R - L > 1) {
        JustDoIt(L, R);
      }
      L = R = i;
    } else {
      ++R;
    }
  }
  cout << ans << endl;
  for (int i = 1; i < n + 1; ++i) {
    cout << arr[i] << ' ';
  }
}
