#include <bits/stdc++.h>
const char en = '\n';
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> V(n + 47, 0);
  for (int i = 0; i < n; i++) {
    cin >> V[i];
  }
  vector<long long> K(n + 47, 0);
  K[0] = 1;
  K[n - 1] = 1;
  int naj = 0;
  for (int i = 1; i < n - 1; i++) {
    if (V[i - 1] == V[i] || V[i + 1] == V[i]) K[i] = 1;
  }
  int pos = 0;
  for (int i = 1; i < n; i++) {
    if (K[i]) {
      naj = max(naj, pos);
      if (pos % 2 == 1) {
        for (int j = i - 1; j >= i - pos; j--) V[j] = V[i];
      } else {
        for (int j = i - 1; j >= i - pos / 2; j--) V[j] = V[i];
        for (int j = i - pos / 2 - 1; j >= i - pos; j--) V[j] = V[i - pos - 1];
      }
      naj = max(naj, pos);
      pos = 0;
    } else
      pos++;
  }
  cout << naj / 2 + naj % 2 << en;
  for (int i = 0; i < n; i++) cout << V[i] << " \n"[i == n - 1];
}
