#include <bits/stdc++.h>
using namespace std;
int a[5 * 100005];
int calc(int l, int r) {
  if (a[l] == a[r]) {
    for (int i = l + 1; i < r; i++) a[i] = a[l];
  } else {
    for (int i = l + 1; i < (r + l + 1) / 2; i++) a[i] = a[l];
    for (int i = (r + l + 1) / 2; i < r; i++) a[i] = a[r];
  }
  return (r - l) / 2;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int last = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (i == n - 1 || a[i] == a[i + 1]) {
      ans = max(ans, calc(last, i));
      last = i + 1;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) cout << a[i] << ' ';
  return 0;
}
