#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n + 4), b(n + 4);
  for (int i = 1; i < n + 1; i++) cin >> a[i];
  a[0] = a[1];
  a[n + 1] = a[n];
  int i = 1, j;
  int mx = 0;
  while (i <= n) {
    j = i;
    if (a[j] != a[j - 1] && a[j] != a[j + 1]) {
      int res = 0;
      while (a[j] != a[j - 1] && a[j] != a[j + 1] && j < n + 1) {
        res++;
        j++;
      }
      if (res & 1) {
        mx = max(mx, (res + 1) / 2);
        int bit = a[j];
        for (int k = i; k < j; k++) {
          b[k] = bit;
        }
      } else {
        mx = max(mx, res / 2);
        int len = res / 2;
        int bit = a[i - 1];
        int k = i;
        while (k < j) {
          if (len)
            b[k] = bit, len--;
          else
            b[k] = bit ^ 1;
          k++;
        }
      }
      i = j;
    } else {
      b[i] = a[i];
      i++;
    }
  }
  cout << mx << "\n";
  for (i = 1; i <= n; i++) {
    cout << b[i] << " ";
  }
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
