#include <bits/stdc++.h>
using namespace std;
void Solve() {
  long long int n;
  cin >> n;
  bool a[n];
  for (long long int i = 0; i <= n - 1; i++) cin >> a[i];
  long long int mxlen = 0;
  long long int ans[n];
  ans[0] = a[0];
  ans[n - 1] = a[n - 1];
  for (long long int i = 1; i <= n - 2; i++) {
    if (a[i] == a[i - 1] || a[i] == a[i + 1])
      ans[i] = a[i];
    else {
      long long int l = i, r = i;
      while (r + 1 < n - 1 && a[r + 1] != a[r] && a[r + 1] != a[r + 2]) {
        r++;
      }
      if (l == r)
        ans[i] = !a[i];
      else {
        if (a[l] == a[r])
          for (long long int j = l; j <= r; j++) ans[j] = !a[l];
        else {
          long long int len = r - l + 1;
          for (long long int j = l; j <= l + len / 2 - 1; j++) ans[j] = !a[l];
          for (long long int j = l + len / 2; j <= l + len - 1; j++)
            ans[j] = a[l];
        }
      }
      mxlen = max(mxlen, r - l + 1);
      i = r;
    }
  }
  cout << (mxlen + 2 - 1) / (2) << endl;
  for (long long int i = 0; i <= n - 1; i++) cout << ans[i] << " ";
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  ;
  int T = 1;
  while (T--) Solve();
  return 0;
}
