#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
int n, a[N];
bool f[N];
int cur, ans;
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) {
      scanf("%d", a + i);
    }
    f[0] = f[n - 1] = 1;
    ans = cur = 0;
    for (int i = 1; i < n - 1; i++) {
      if (a[i] == a[i - 1] || a[i] == a[i + 1]) {
        f[i] = 1;
        cur = 0;
      } else {
        f[i] = 0;
        cur++;
      }
      ans = max(ans, (cur + 1) / 2);
    }
    printf("%d\n", ans);
    int x = -1, y;
    for (int i = 0; i < n; i++) {
      if (f[i]) {
        if (x != -1) {
          y = i;
          if (a[x] == a[y]) {
            for (int j = x + 1; j <= y; j++) a[j] = a[x];
          } else {
            for (int j = x + 1, k = y - 1; j < k; j++, k--) {
              a[j] = a[x];
              a[k] = a[y];
            }
          }
        }
        x = i;
      }
    }
    for (int i = 0; i < n; i++) {
      printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
    }
  }
  return 0;
}
