#include <bits/stdc++.h>
inline int max(int x, int y) { return (x > y ? x : y); }
int n, ans, start;
int a[500002];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  ans = 0;
  start = 0;
  for (int i = 1; i <= n; i++)
    if ((i == n) || (a[i - 1] == a[i])) {
      ans = max(ans, (i - 1 - start) / 2);
      if (a[i - 1] == a[start]) {
        for (int j = start + 1; j < i - 1; j++) a[j] = a[i - 1];
      } else {
        int l = start + 1, r = i - 2;
        while (l < r) {
          a[l] = a[start];
          a[r] = a[i - 1];
          l++;
          r--;
        }
      }
      start = i;
    }
  printf("%d\n", ans);
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
  return 0;
}
