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