#include <bits/stdc++.h>
using namespace std;
long long n, a[500005], b[500005], ans = 0;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  long long st = 0, l = 0;
  for (int i = 0; i < n; i++) {
    if (a[i + 1] != a[i] and i + 1 < n) {
      continue;
    } else {
      if (i - l + 1 >= 3) {
        if (a[i] == a[l]) {
          ans = max(ans, (i - l - 2) / 2 + 1);
          for (int j = l; j <= i; j++) b[j] = a[l];
        } else {
          ans = max(ans, (i - l - 3) / 2 + 1);
          for (int j = l; j <= (l + i) / 2; j++) {
            b[j] = a[l];
          }
          for (int j = (l + i) / 2 + 1; j <= i; j++) b[j] = a[i];
        }
      }
      l = i + 1;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
  return 0;
}
