#include <bits/stdc++.h>
using namespace std;
const int maxn = 500000 + 5;
int n;
int a[maxn];
int modify(int l, int r) {
  int i, m;
  if (l == r) return 0;
  if (a[l] == a[r]) {
    for (i = l + 1; i < r; ++i) a[i] = a[l];
    return (r - l) / 2;
  } else {
    m = (l + r + 1) / 2;
    for (i = l + 1; i < m; ++i) a[i] = a[l];
    for (i = m; i < r; ++i) a[i] = a[r];
    return (r - l - 1) / 2;
  }
}
int main() {
  int i, j, k, ans, lb;
  cin >> n;
  for (i = 0; i < n; ++i) cin >> a[i];
  ans = 0;
  lb = 0;
  for (i = 0; i < n; ++i) {
    if (i == n - 1 || a[i] == a[i + 1]) {
      ans = max(ans, modify(lb, i));
      lb = i + 1;
    }
  }
  cout << ans << endl;
  for (i = 0; i < n; ++i) cout << a[i] << " ";
  return 0;
}
