#include <bits/stdc++.h>
using namespace std;
int N;
const int NMax = 500005;
int Array[NMax];
vector<pair<int, int> > Segment;
void Read() {
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> Array[i];
}
void Solve() {
  int Max = 0, point, last = 0;
  for (int i = 2; i < N; i++) {
    if (Array[i] != Array[i - 1] && Array[i] != Array[i + 1]) {
      if (last == i - 1) {
        Segment[Segment.size() - 1].second = i;
        last = i;
      } else
        Segment.push_back(make_pair(i, i));
      last = i;
      Max = max(Max, Segment[Segment.size() - 1].second -
                         Segment[Segment.size() - 1].first + 1);
    }
  }
  cout << Max / 2 + Max % 2 << "\n";
  for (int i = 0; i < Segment.size(); i++) {
    int val = Array[Segment[i].first - 1], val2 = Array[Segment[i].second + 1];
    if (val == val2)
      for (int j = Segment[i].first; j <= Segment[i].second; j++)
        Array[j] = val;
    else
      for (int j = Segment[i].first; j <= Segment[i].second; j++) {
        if (j - Segment[i].first + 1 <=
            (Segment[i].second - Segment[i].first + 1) / 2)
          Array[j] = val;
        else
          Array[j] = val2;
      }
  }
  for (int i = 1; i <= N; i++) cout << Array[i] << " ";
  cout << "\n";
}
int main() {
  Read();
  Solve();
  return 0;
}
