#include <bits/stdc++.h>
using namespace std;
int a[500005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  int ans = 0;
  for (int i = 1; i <= n;) {
    int j = i;
    while (j + 1 <= n && a[j] != a[j + 1]) ++j;
    int len = j - i + 1;
    if (a[i] == a[j]) {
      for (int k = i + 1; k <= j; ++k) a[k] = a[i];
      ans = max(ans, len / 2);
    } else {
      int k;
      for (k = i + 1; k <= (i + j) / 2; ++k) a[k] = a[i];
      for (k; k < j; ++k) a[k] = a[j];
      ans = max(ans, len / 2 - 1);
    }
    i = j + 1;
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; ++i) {
    if (i != 1) printf(" ");
    printf("%d", a[i]);
  }
  printf("\n");
  return 0;
}
