#include <bits/stdc++.h>
using namespace std;
int const MAXN = 5e5 + 10;
int n, a[MAXN], ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i + 1]) {
      int pt = i + 1, tam = 1;
      while (a[pt] != a[pt + 1] && pt != n) pt++, tam++;
      if (a[i] == a[pt])
        for (int j = i; j <= pt; j++) a[j] = a[i];
      else {
        tam--;
        for (int j = i; j <= i + tam / 2; j++) a[j] = a[i];
        for (int j = i + tam / 2 + 1; j <= pt; j++) a[j] = a[pt];
      }
      ans = max(ans, tam / 2);
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  printf("\n");
}
