#include <bits/stdc++.h>
using namespace std;
const int N = 500000 + 5;
int n, a[N];
int b[N];
void solve() {
  for (int i = 1; i <= n; i++) {
    if (i == 1 || i == n)
      b[i] = 0;
    else {
      if (a[i] != a[i - 1] && a[i] != a[i + 1])
        b[i] = 1;
      else
        b[i] = 0;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (b[i]) {
      int nxt = i;
      while (nxt + 1 <= n && b[nxt + 1]) nxt++;
      ans = max(ans, (nxt - i + 1 + 1) / 2);
      if ((nxt - i + 1) & 1) {
        int sum = nxt - i + 1;
        for (int j = i; j <= nxt; j++) a[j] = a[i - 1];
      } else {
        int sum = nxt - i + 1;
        for (int j = i; j < i + sum / 2; j++) a[j] = a[i - 1];
        for (int j = i + sum / 2; j <= nxt; j++) a[j] = a[nxt + 1];
      }
      i = nxt;
    }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  puts("");
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  solve();
  return 0;
}
