#include <bits/stdc++.h>
using namespace std;
int a[500005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int l = 1;
  int r = 1;
  a[n + 1] = a[n];
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] != a[i + 1])
      r = i + 1;
    else {
      ans = max(ans, (r - l) / 2);
      if ((r - l + 1) & 1) {
        for (int j = l; j <= r; j++) a[j] = a[l];
      } else {
        int mid = (l + r) >> 1;
        for (int j = l; j <= mid; j++) {
          a[j] = a[l];
        }
        for (int j = mid + 1; j <= r; j++) {
          a[j] = a[r];
        }
      }
      l = r = i + 1;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
