#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int total, val[500005];
bool mark[500005];
int main() {
  scanf("%d", &total);
  int k = 0, ans = 0;
  for (int i = 0; i < total; i++) {
    scanf("%d", val + i);
  }
  for (int i = 1; i < total - 1; i++)
    if (val[i - 1] != val[i] && val[i + 1] != val[i])
      k++;
    else {
      ans = max(ans, (k + 1) / 2);
      int o = val[i - k - 1];
      for (int j = i - k; j < i - (k + 1) / 2; j++) val[j] = o;
      for (int j = i - 1; j >= i - (k + 1) / 2; j--) val[j] = val[i];
      k = 0;
    }
  ans = max(ans, (k + 1) / 2);
  int o = val[total - k - 2];
  for (int i = total - 1 - k; i < total - 1 - (k + 1) / 2; i++) val[i] = o;
  for (int i = total - 2; i >= total - 1 - (k + 1) / 2; i--)
    val[i] = val[total - 1];
  printf("%d\n", ans);
  for (int i = 0; i < total; i++) printf("%d ", val[i]);
  return 0;
}
