#include <bits/stdc++.h>
using namespace std;
int a[1000000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ops = 0;
  for (int i = 0; i < n; i++) {
    while (i < n - 1 && a[i] == a[i + 1]) {
      i++;
    }
    int start = i;
    int count = 1;
    while (i < n - 1 && a[i] != a[i + 1]) {
      i++;
      count++;
    }
    if (count % 2 == 0) {
      ops = max(ops, count / 2 - 1);
      for (int j = 0; j < count / 2; j++) {
        a[start + j] = a[start];
      }
      for (int j = count / 2; j < count; j++) {
        a[start + j] = a[i];
      }
    } else {
      for (int j = 0; j < count; j++) {
        a[start + j] = a[start];
      }
      ops = max(ops, count / 2);
    }
  }
  cout << ops << endl;
  for (int i = 0; i < n; i++) cout << a[i] << (i == n - 1 ? "\n" : " ");
  return 0;
}
