#include <bits/stdc++.h>
int r[600000], v[600000], t[600000];
int main() {
  int n, i, j, p, q, ans;
  fscanf(stdin, "%d", &n);
  for (i = 1; i <= n; i++) {
    fscanf(stdin, "%d", &v[i]);
  }
  t[1] = t[n] = 1;
  r[1] = v[1];
  r[n] = v[n];
  for (i = 2; i < n; i++) {
    if ((v[i] == v[i - 1]) || (v[i] == v[i + 1])) {
      t[i] = 1;
      r[i] = v[i];
    }
  }
  i = 1;
  ans = 0;
  while (i <= n) {
    p = i;
    while ((p <= n) && (t[p] == 1)) {
      p++;
    }
    q = p;
    while ((q <= n) && (t[q] == 0)) {
      q++;
    }
    q--;
    i = q + 1;
    if ((q < n) && (p < n)) {
      if (ans < (q - p) / 2 + 1) {
        ans = (q - p) / 2 + 1;
      }
      if (v[p - 1] == v[q + 1]) {
        for (j = p; j <= q; j++) {
          r[j] = v[p - 1];
        }
      } else {
        for (j = p; j < p + (q - p + 1) / 2; j++) {
          r[j] = v[p - 1];
        }
        for (j = p + (q - p + 1) / 2; j <= q; j++) {
          r[j] = v[q + 1];
        }
      }
    }
  }
  fprintf(stdout, "%d\n", ans);
  for (i = 1; i <= n; i++) {
    fprintf(stdout, "%d ", r[i]);
  }
  fclose(stdin);
  fclose(stdout);
  return 0;
}
