#include <bits/stdc++.h>
using namespace std;
long long qp(long long a, long long b, long long mod) {
  long long t = 1;
  while (b) {
    if (b & 1) t = t * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return t;
}
struct DOT {
  int x;
  int y;
};
inline void read(int &x) {
  int k = 0;
  char f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) k = k * 10 + c - '0';
  x = k * f;
}
void ex() {
  puts("No");
  exit(0);
}
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {1, -1, 0, 0};
const int inf = 0x3f3f3f3f;
const long long Linf = 0x3f3f3f3f3f3f3f3f;
const long long mod = 1e9 + 7;
;
const int maxn = 5e5 + 34;
int n;
int cnt;
int l[maxn], r[maxn];
int a[maxn];
int res[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int ans = 0;
  memset(res, -1, sizeof res);
  res[1] = a[1];
  res[n] = a[n];
  int f = 0;
  for (int i = 2; i <= n; i++) {
    if (!f) {
      if (a[i] != a[i - 1]) {
        l[++cnt] = i - 1;
        f = 1;
      }
    } else {
      if (a[i] == a[i - 1]) {
        r[cnt] = i - 1;
        f = 0;
        ans = max(ans, r[cnt] - l[cnt] >> 1);
      }
    }
  }
  if (f) {
    r[cnt] = n;
    ans = max(ans, r[cnt] - l[cnt] >> 1);
  }
  for (int i = 1; i <= cnt; i++) {
    int mid = r[i] + l[i] >> 1;
    for (int j = l[i]; j <= mid; j++) {
      res[j] = a[l[i]];
    }
    for (int j = mid + 1; j <= r[i]; j++) {
      res[j] = a[r[i]];
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) {
    if (res[i] != -1)
      printf("%d ", res[i]);
    else
      printf("%d ", a[i]);
  }
}
