#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int tab[500001];
  int tab2[500001];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tab[i];
  }
  int time = 0;
  int current_unstable = 0;
  for (int i = 1; i < n - 1; i++) {
    if (tab[i] == tab[i - 1] || tab[i] == tab[i + 1]) {
      if (current_unstable) {
        if (current_unstable % 2 == 0)
          for (int j = 1; j <= current_unstable / 2; j++) {
            tab2[i - j] = 2;
          }
        time = (time > current_unstable ? time : current_unstable);
        current_unstable = 0;
      }
      tab2[i] = 0;
    } else {
      current_unstable++;
      tab2[i] = 1;
    }
  }
  time = (time > current_unstable ? time : current_unstable);
  if (current_unstable % 2 == 0)
    for (int j = 1; j <= current_unstable / 2; j++) {
      tab2[n - 1 - j] = 2;
    }
  cout << (time / 2) + (time % 2) << "\n";
  int last_stable = tab[0];
  for (int i = 0; i < n; i++) {
    if (i == 0)
      cout << tab[0] << " ";
    else if (i == n - 1)
      cout << tab[i] << "\n";
    else {
      if (tab2[i]) {
        if (tab2[i] == 1)
          cout << last_stable << " ";
        else
          cout << (2 - last_stable) / 2 << " ";
      } else {
        cout << tab[i] << " ";
        last_stable = tab[i];
      }
    }
  }
}
