#include <bits/stdc++.h>
using namespace std;
const int N = 1000100;
int a[N], b[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int ret = 0;
  for (int i = 0; i < n; i++) {
    int j = i;
    while (j + 1 < n && a[j + 1] != a[j]) {
      j++;
    }
    int m = j - i + 1;
    if (m & 1) {
      for (int k = i; k <= j; k++) b[k] = a[i];
    } else {
      for (int k = i; k < i + m / 2; k++) {
        b[k] = a[i];
      }
      for (int k = i + m / 2; k <= j; k++) {
        b[k] = a[j];
      }
    }
    ret = max(ret, (m - 1) / 2);
    i = j;
  }
  printf("%d\n", ret);
  for (int i = 0; i < n; i++) {
    printf("%d ", b[i]);
  }
  return 0;
}
