#include <bits/stdc++.h>
using namespace std;
struct less_key {
  bool operator()(const pair<double, int32_t>& p1,
                  const pair<double, int32_t>& p2) {
    return p1.first < p2.first ||
           (p1.first == p2.first && p1.second > p2.second);
  }
};
struct pair_hash {
  std::size_t operator()(const pair<int32_t, int32_t>& k) const {
    return static_cast<size_t>(k.first ^ k.second);
  }
};
bool a[500005];
int32_t n;
vector<pair<int32_t, int32_t> > c;
vector<pair<int32_t, int32_t> > r;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int32_t i = 1; i <= n; i++) {
    cin >> a[i];
  }
  a[0] = a[1];
  a[n + 1] = a[n];
  bool f = true;
  int32_t s = 0, e = 0;
  for (int32_t i = 0; i <= n; i++) {
    if (a[i] == a[i + 1]) {
      if (!f) {
        s = i;
      }
      f = true;
    } else {
      if (f) {
        e = i;
        c.push_back(make_pair(s, e));
      }
      f = false;
    }
  }
  c.push_back(make_pair(s, n + 1));
  for (int32_t i = 0; i < c.size() - 1; i++) {
    r.push_back(make_pair(c[i].second, c[i + 1].first));
  }
  int32_t m = 0;
  for (int32_t i = 0; i < r.size(); i++) {
    int32_t e = r[i].second - r[i].first + 1;
    m = max(m, (e - 1) / 2);
    if (a[r[i].first] == a[r[i].second]) {
      for (int32_t j = r[i].first + 1; j < r[i].second; j++) {
        a[j] = a[r[i].first];
      }
    } else {
      for (int32_t j = r[i].first + 1; j < r[i].first + e / 2; j++) {
        a[j] = a[r[i].first];
      }
      for (int32_t j = r[i].first + e / 2; j < r[i].second; j++) {
        a[j] = a[r[i].second];
      }
    }
  }
  cout << m << endl;
  for (int32_t i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
