#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) (ch == '-') && (f = -1), ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return x * f;
}
int n, a[500005], g, ans;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
  }
  a[0] = a[1], a[n + 1] = a[n];
  for (int i = 1; i <= n; i++) {
    if (a[i - 1] != a[i] && a[i] != a[i + 1])
      g++;
    else {
      ans = max(ans, (g + 1) / 2);
      if (g & 1) {
        while (g) {
          a[i - g] = a[i];
          g--;
        }
      } else {
        int t = i - g - 1;
        while (g) {
          if (g > (i - t - 1) / 2)
            a[i - g] = a[t];
          else
            a[i - g] = a[i];
          g--;
        }
      }
      g = 0;
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  return 0;
}
