#include <bits/stdc++.h>
using namespace std;
inline long long tofan(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
long long n, cnt, maxi;
bool a[(501 * 1000)], mark;
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n - 1; i++) {
    if (a[i] != a[i - 1] && a[i] != a[i + 1])
      cnt++, mark = 1, v.push_back(i);
    else
      cnt = 0;
    maxi = max(maxi, cnt);
  }
  if (!mark)
    cout << "0\n";
  else
    cout << (maxi - 1) / 2 + 1 << "\n";
  cnt = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i - 1] && a[i] != a[i + 1] && i != n - 1) {
      cnt++, v.push_back(i);
    } else {
      if (cnt % 2 == 1)
        for (int j = i - cnt; j < i; j++) a[j] = a[i];
      else {
        int j, p = 0;
        for (j = i - cnt; p < cnt / 2; j++, p++) a[j] = a[i - cnt - 1];
        for (; j < i; j++) a[j] = a[i];
      }
      cnt = 0;
    }
    maxi = max(maxi, cnt);
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
