#include <bits/stdc++.h>
using namespace std;
const int N = 500001;
int a[N];
int stabilize(int f, int t) {
  int n = t - f - 1;
  if (n <= 0) return n;
  if (a[f] == a[t]) {
    for (int i = f + 1; i < t; i++) a[i] = a[f];
    return (n + 1) / 2;
  }
  for (int i = f + 1, j = t - 1; i < j; i++, j--) {
    a[i] = a[f];
    a[j] = a[t];
  }
  return n / 2;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int result = 0;
  int last = 1;
  while (last < n && a[last] == a[0]) last++;
  last--;
  for (int i = last + 1; i < n;) {
    if (i + 1 == n || a[i] == a[i + 1]) {
      int cur = stabilize(last, i);
      result = max(result, cur);
      last = i + 2;
      while (last < n && a[last] == a[i]) last++;
      last--;
      i = last + 1;
    } else {
      i++;
    }
  }
  printf("%d\n", result);
  for (int i = 0; i + 1 < n; i++) {
    printf("%d ", a[i]);
  }
  printf("%d\n", a[n - 1]);
}
