#include <bits/stdc++.h>
using namespace std;
int main() {
  int *a, *b;
  int n;
  cin >> n;
  a = new int[n];
  b = new int[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    b[i] = 0;
  }
  int count = 0;
  bool eq = false;
  int t = 0;
  b[0] = a[0];
  for (int i = 0; i < n; ++i) {
    int st = i;
    do {
      ++i;
    } while (a[i] != a[i - 1] && i < n);
    if (i - 1 - st > 1) {
      int t = (i - st - 1) / 2;
      count = max(count, t);
      int t1 = st, t2 = i - 1;
      if (a[t1] == a[t2]) {
        b[(t1 + t2) / 2] = a[t1];
      }
      while (t1 < t2) {
        b[t1++] = a[st];
        b[t2--] = a[i - 1];
      }
      --i;
    } else if (i - 1 - st > 0) {
      --i;
      b[i] = a[i];
      b[i - 1] = a[i - 1];
    } else {
      --i;
      b[i] = a[i];
    }
  }
  cout << count << endl;
  for (int i = 0; i < n; ++i) {
    cout << b[i] << ' ';
  }
  return 0;
}
