#include <bits/stdc++.h>
bool a[500001];
std::set<std::pair<int, int>> unstable;
int main() {
  int n;
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  int start = -1, end = -1, maxlength = 0;
  for (int i = 1; i < n; i++) {
    if (i < n - 1 && a[i] != a[i - 1] && a[i] != a[i + 1]) {
      if (start == -1) start = i;
      end = i;
    } else {
      if (start != -1) {
        unstable.insert(std::make_pair(start, end));
        maxlength =
            std::max((end - start + 1) / 2 + (end - start + 1) % 2, maxlength);
        start = -1;
      }
    }
  }
  for (auto p : unstable) {
    for (int i = p.first; i <= (p.second + p.first) / 2; i++) a[i] = a[i - 1];
    for (int i = p.second; i >= (p.second + p.first) / 2 + 1; i--)
      a[i] = a[i + 1];
  }
  std::cout << maxlength << std::endl;
  for (int i = 0; i < n; i++) {
    std::cout << a[i] << " ";
  }
  return 0;
}
