#include <bits/stdc++.h>
using namespace std;
int a[500000];
int b[500000];
int solve(int l, int r) {
  if (l == r) return 0;
  if (a[l] == a[r]) {
    for (int i = l; i <= r; i++) a[i] = a[l];
  } else {
    int mid = (l + r) / 2;
    for (int i = l; i <= mid; i++) a[i] = a[l];
    for (int i = r; i > mid; i--) a[i] = a[r];
  }
  return (l + r) / 2 - l;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int s = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == a[i + 1] || i == n - 1) {
      ans = max(ans, solve(s, i));
      s = i + 1;
    }
  }
  printf("%d\n", ans);
  for (int i = 0; i < n - 1; i++) printf("%d ", a[i]);
  printf("%d\n", a[n - 1]);
  return 0;
}
