#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500 * 1000 + 10;
int a[MAXN], res[MAXN];
vector<pair<int, int> > v;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int j = i;
    while (j < n && a[j] == a[i]) j++;
    v.push_back(make_pair(a[i], j - i));
    i = j - 1;
  }
  if (((int)(v).size()) < 3) {
    cout << 0 << endl;
    for (int i = 0; i < (n); i++) cout << a[i] << ' ';
    cout << endl;
    return 0;
  }
  int ans = 0;
  for (int i = 0; i < v[0].second; i++) res[i] = v[0].first;
  int cur = v[0].second;
  for (int i = 1; i < ((int)(v).size()) - 1; i++) {
    int j = i;
    while (j < ((int)(v).size()) - 1 && v[j].second == 1) j++;
    if ((j - i) & 1) {
      ans = max(ans, (j - i + 1) / 2);
      for (int k = cur; k < cur + j - i; k++) res[k] = v[i - 1].first;
    } else {
      ans = max(ans, (j - i) / 2);
      for (int k = cur; k < cur + (j - i) / 2; k++) res[k] = v[i - 1].first;
      for (int k = cur + (j - i) / 2; k < cur + j - i; k++) res[k] = v[j].first;
    }
    if (j > i)
      cur += j - i, i = j - 1;
    else {
      for (int k = cur; k < cur + v[i].second; k++) res[k] = v[i].first;
      cur += v[i].second;
    }
  }
  for (int i = cur; i < n; i++) res[i] = v.back().first;
  cout << ans << endl;
  for (int i = 0; i < n; i++) cout << res[i] << ' ';
  cout << endl;
  return 0;
}
