#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a < b) return b;
  return a;
}
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
void solve() {
  long long n;
  cin >> n;
  long long arr[n];
  long long ans[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long maxi = 0;
  for (int i = 0, j = i; i < n; i = j) {
    j++;
    if (arr[i] == arr[j]) {
      ans[i] = arr[i];
      continue;
    }
    while (j < n && arr[j] != arr[j - 1]) j++;
    long long len = j - i;
    maxi = max(maxi, (len - 1) / 2);
    if (len % 2) {
      for (int k = i; k < j; k++) ans[k] = arr[i];
    } else {
      for (int k = i; k < (i + j) / 2; k++) ans[k] = arr[i];
      for (int k = (i + j) / 2; k < j; k++) ans[k] = arr[j - 1];
    }
  }
  ans[0] = arr[0];
  ans[n - 1] = arr[n - 1];
  cout << maxi << "\n";
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
