#include <bits/stdc++.h>
using namespace std;
vector<int> a, f;
vector<pair<int, int> > q;
int main() {
  ios_base::sync_with_stdio(0);
  int n, it = 1, ans = 0;
  cin >> n;
  a.resize(n);
  f.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n - 1; i++) {
    if (a[i] != a[i - 1] && a[i] != a[i + 1]) f[i] = 1;
  }
  while (it < n - 1) {
    if (!f[it]) {
      it++;
    } else {
      int tmp = it;
      while (it < n - 1 && f[it]) it++;
      q.push_back(make_pair(tmp, it - 1));
      it++;
    }
  }
  for (int i = 0; i < q.size(); i++) {
    ans = max((q[i].second - q[i].first + 2) / 2, ans);
    for (int j = q[i].first; j <= q[i].second; j++) {
      int dl = j - q[i].first, dr = q[i].second - j;
      if (dl < dr)
        a[j] = a[q[i].first - 1];
      else
        a[j] = a[q[i].second + 1];
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
