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