#include <bits/stdc++.h>
using namespace std;
int l, n, temp, ans, a[1000001], b[1000001];
bool f;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  ans = 0;
  f = true;
  l = 1;
  b[1] = a[1];
  b[n] = a[n];
  a[n + 1] = a[n];
  for (int i = 2; i <= n + 1; i++) {
    if (a[i] == a[i - 1]) {
      b[i] = a[i];
      if (f) {
        temp = i - 2 - l;
        if (temp > ans) {
          ans = temp;
        }
        f = false;
        for (int j = l + 1; j <= (i - 1 + l) / 2; j++) b[j] = a[l];
        for (int j = (i - 1 + l) / 2 + 1; j <= i - 1; j++) b[j] = a[i];
      }
      l = i;
    } else {
      f = true;
    }
  }
  cout << (ans + 1) / 2 << endl;
  for (int i = 1; i <= n; i++) cout << b[i] << ' ';
  return 0;
}
