#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500005;
int N;
int A[MAXN];
int ans = 0;
void update(int i, int cnt) {
  ans = max(ans, (cnt - 1) / 2);
  if (cnt % 2 == 1) {
    for (int j = i - cnt; j < i; j++) A[j] = A[i];
  } else {
    for (int j = i - cnt; j < i - cnt / 2; j++) A[j] = A[i] ^ 1;
    for (int j = i - cnt / 2; j < i; j++) A[j] = A[i];
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  A[N] = A[N - 1];
  int cnt = 1;
  for (int i = 1; i <= N; i++) {
    if (A[i] != A[i - 1])
      cnt++;
    else {
      update(i, cnt);
      cnt = 1;
    }
  }
  cout << ans << "\n";
  for (int i = 0; i < N; i++) cout << A[i] << " ";
  return 0;
}
