#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, a[500005], rs;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (i = 1; i <= n; ++i) cin >> a[i];
  for (i = 1; i < n; i = j + 1) {
    for (j = i; j < n && a[j] != a[j + 1]; ++j)
      ;
    rs = max(rs, (j - i) / 2);
    if ((j - i + 1) & 1) {
      for (k = i; k <= j; ++k) a[k] = a[i];
    } else {
      for (k = 0; k < (j - i + 1) / 2; ++k) a[i + k] = a[i];
      for (k = (j - i + 1) / 2; k < (j - i + 1); ++k) a[i + k] = a[j];
    }
  }
  cout << rs << '\n';
  for (i = 1; i <= n; ++i) cout << a[i] << " \n"[i == n];
  return 0;
}
