#include <bits/stdc++.h>
using namespace std;
int a[500010], n, ans = 0;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int x = 1;
  while (x < n) {
    while ((x < n) && (a[x] == a[x + 1])) x++;
    int y = x;
    while ((x < n) && (a[x] != a[x + 1])) x++;
    if (x - y >= 2) {
      if (a[y] == a[x]) {
        for (int i = y; i <= x; i++) a[i] = a[y];
        ans = max(ans, (x - y) / 2);
      } else {
        for (int i = y; i <= (x + y) / 2; i++) a[i] = a[y];
        for (int i = ((x + y) / 2) + 1; i <= x; i++) a[i] = a[x];
        ans = max(ans, (x - y) / 2);
      }
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
}
