#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[500010];
  vector<int> fixed;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  fixed.push_back(0);
  for (int i = 1; i < n - 1; ++i)
    if (a[i] == a[i - 1] || a[i] == a[i + 1]) fixed.push_back(i);
  fixed.push_back(n - 1);
  fixed.push_back(n);
  int f = 0;
  for (int i = 0; i < n; ++i) {
    if (fixed[f + 1] == i) {
      ++f;
    } else if (fixed[f] < i && i < fixed[f + 1]) {
      int mid = (fixed[f] + fixed[f + 1]) / 2;
      if (i <= mid)
        a[i] = a[fixed[f]];
      else
        a[i] = a[fixed[f + 1]];
    }
  }
  int time = fixed[1] - fixed[0];
  for (int i = 1; i < fixed.size(); ++i)
    time = max(time, fixed[i] - fixed[i - 1]);
  printf("%d\n", time / 2);
  for (int i = 0; i < n; ++i) printf("%d ", a[i]);
}
