#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int ans = 0, lf = 0;
  for (int i = 0; i < n; ++i) {
    if (i == n - 1 or a[i] == a[i + 1]) {
      int res;
      if (lf == i) {
        res = 0;
      } else if (a[lf] == a[i]) {
        for (int j = lf + 1; j < i; j++) a[j] = a[lf];
        res = (i - lf) / 2;
      } else {
        int m = (lf + i + 1) / 2;
        for (int j = lf + 1; j < m; j++) a[j] = a[lf];
        for (int j = m; j < i; j++) a[j] = a[i];
        res = (i - lf - 1) / 2;
      }
      ans = max(ans, res);
      lf = i + 1;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n; ++i) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
