#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int main() {
  int a[500005], n;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    int m = n;
    int len = 0;
    int ans = 0;
    int L = 0;
    a[n] = 2;
    for (int i = 0; i < n; i++) {
      len++;
      if (a[i] == a[i + 1] || i == n - 1) {
        ans = max((len + 1) / 2 - 1, ans);
        int l = L + 1, r = i - 1;
        while (l <= r) {
          a[l++] = a[L];
          a[r--] = a[i];
        }
        len = 0;
        L = i + 1;
      }
    }
    printf("%d\n", ans);
    for (int i = 0; i < m; i++) printf("%d ", a[i]);
  }
  return 0;
}
