#include <bits/stdc++.h>
namespace {
using std::cin;
using std::cout;
using std::max;
using std::vector;
}  // namespace
int main() {
  int n;
  cin >> n;
  vector<int> a;
  vector<int> b(n);
  std::copy(std::istream_iterator<int>(cin), std::istream_iterator<int>(),
            std::back_inserter(a));
  int step_count = 0;
  for (int i = 0; i < n - 1;) {
    int j;
    for (j = i; j < n - 1 && a[j] != a[j + 1]; ++j) {
    }
    int span = j - i + 1;
    int half_span = span >> 1;
    for (int k = i; k < i + half_span; ++k) {
      b[k] = a[i];
    }
    for (int k = i + half_span; k < i + span; ++k) {
      b[k] = a[j];
    }
    step_count = max(step_count, (span - 1) >> 1);
    i = j + 1;
    if (i == n - 1) {
      b[i] = a[i];
    }
  }
  cout << step_count << '\n';
  std::copy(b.begin(), b.end(), std::ostream_iterator<int>(cout, " "));
  return 0;
}
