#include <bits/stdc++.h>
using namespace std;
int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  x = ch - '0';
  while (1) {
    ch = getchar();
    if (ch < '0' || ch > '9') break;
    x = x * 10 + ch - '0';
  }
  return x * f;
}
const int maxn = 500100;
int n, a[maxn], res[maxn], stable[maxn], cnt, ans;
int main() {
  n = read();
  a[0] = -1;
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    res[i] = a[i];
    if (a[i] == a[i - 1]) stable[i] = stable[i - 1] = 1;
  }
  stable[1] = stable[n] = 1;
  for (int i = 2; i <= n; i++)
    if (!stable[i]) {
      cnt++;
      ans = max(ans, cnt);
    } else {
      if (cnt > 0) {
        for (int j = i - cnt; j < i - cnt / 2; j++) res[j] = a[i - cnt - 1];
        for (int j = i - cnt / 2; j < i; j++) res[j] = a[i];
      }
      cnt = 0;
    }
  printf("%d\n%d", (ans + 1) / 2, res[1]);
  for (int i = 2; i <= n; i++) printf(" %d", res[i]);
  return 0;
}
