#include <bits/stdc++.h>
using namespace std;
const int N = 500001;
int n, a[N];
int ans = 0;
void solve(int l, int r) {
  int cnt = 0;
  while (l < r) {
    a[l++] = a[l - 1];
    a[r--] = a[r + 1];
    cnt++;
  }
  if (l == r) a[l] = a[l - 1], cnt++;
  ans = max(ans, cnt);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i < n - 1; ++i) {
    if (a[i] != a[i - 1] && a[i] != a[i + 1]) {
      int l = i;
      int r = i;
      while (i < n - 1 && a[i] != a[i - 1] && a[i] != a[i + 1]) i++;
      i--;
      r = i;
      solve(l, r);
    }
  }
  printf("%d\n", ans);
  for (int i = 0; i < n; ++i) printf("%d ", a[i]);
  return 0;
}
