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