#include <bits/stdc++.h>
using namespace std;
int a[500005], res, l, r, n;
int main() {
  cin >> n;
  for (int i = (1), _b = (n); i <= _b; i++) cin >> a[i];
  l = 2;
  res = 0;
  while (l < n) {
    if (a[l - 1] != a[l] && a[l] != a[l + 1]) {
      r = l + 1;
      l--;
      while ((r < n) && a[r] != a[r + 1]) r++;
      if (a[l] == a[r]) {
        for (int i = (l), _b = (r); i <= _b; i++) a[i] = a[l];
        res = max(res, (r - l + 1) / 2);
      } else {
        for (int i = (l), _b = ((l + r) / 2); i <= _b; i++) a[i] = a[l];
        for (int i = ((l + r) / 2 + 1), _b = (r); i <= _b; i++) a[i] = a[r];
        res = max(res, (r - l + 1) / 2 - 1);
      }
      l = r;
    }
    l++;
  }
  cout << res << endl;
  for (int i = (1), _b = (n); i <= _b; i++) cout << a[i] << " ";
}
