#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> inp(n, 0), out(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> inp[i];
  }
  out[0] = inp[0];
  out.back() = inp.back();
  int i = 0;
  int ans = 0;
  while (i < n) {
    while (i + 1 < n && inp[i] == inp[i + 1]) {
      out[i] = inp[i++];
    };
    ;
    int temp = i;
    while (temp < n - 1 && inp[temp] != inp[temp + 1]) temp++;
    ;
    ;
    int k = (temp - i + 1);
    ;
    ;
    if (k % 2) {
      ans = max(ans, k / 2);
      for (int j = i; j < i + k; j++) out[j] = inp[i];
    } else {
      ans = max(ans, k / 2 - 1);
      for (int j = i; j < i + k / 2; j++) {
        out[j] = inp[i];
      }
      for (int j = i + k / 2; j < i + k; j++) {
        out[j] = !inp[i];
      }
    }
    i = i + k;
  }
  cout << ans << endl;
  for (auto el : out) {
    cout << el << " ";
  }
  cout << endl;
  return 0;
}
