#include <bits/stdc++.h>
using namespace std;
const int maxn = 500005;
char a[maxn];
map<string, bool> mp;
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int l = 0, r;
  a[n] = a[n - 1];
  int ret = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == a[i - 1]) {
      if (l == i - 1)
        l = i;
      else {
        r = i - 1;
        if ((r - l) % 2) {
          for (int j = l + 1; j < (r + l + 1) / 2; j++) a[j] = a[l];
          for (int j = max((l + r + 1) / 2, l + 1); j < r; j++) a[j] = a[r];
        } else {
          for (int j = l + 1; j < r; j++) a[j] = a[l];
        }
        ret = max(ret, (r - l) / 2);
        l = r + 1;
      }
    }
  }
  cout << ret << endl;
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
  return 0;
}
