#include <bits/stdc++.h>
using namespace std;
char buf[1 << 23], *p1 = buf, *p2 = buf, obuf[1 << 23], *O = obuf;
template <typename T>
void read(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  x *= f;
}
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x *= f;
}
template <typename T>
void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
T Min(T x, T y) {
  return x < y ? x : y;
}
template <typename T>
T Max(T x, T y) {
  return x > y ? x : y;
}
template <typename T>
T Abs(T x) {
  return x < 0 ? -x : x;
}
template <typename T>
void Swap(T &x, T &y) {
  T z = x;
  x = y;
  y = z;
}
template <typename T, typename T1>
T qkPow(T a, T1 b, T MOD) {
  T ans = 1;
  for (; b; b >>= 1, a = 1ll * a * a % MOD)
    if (b & 1) ans = 1ll * ans * a % MOD;
  return ans;
}
template <typename T, typename T1>
T qkMul(T a, T1 b, T MOD) {
  T ans = 0;
  for (; b; b >>= 1, a = (a + a) % MOD)
    if (b & 1) ans = (ans + a) % MOD;
  return ans;
}
const int N = 500000 + 5;
int a[N];
int n, ans;
int main() {
  read(n);
  for (int i = 1; i <= n; ++i) read(a[i]);
  int l, r;
  for (int i = 1; i <= n; ++i) {
    l = r = i;
    while (a[r] != a[r + 1] && r < n) ++r;
    int L = l + 1, R = r - 1, cnt = 0;
    while (L <= R) {
      a[L++] = a[l];
      a[R--] = a[r];
      cnt++;
    }
    ans = Max(ans, cnt);
  }
  print(ans), putchar('\n');
  for (int i = 1; i <= n; ++i) print(a[i]), putchar(' ');
  return 0;
}
