#include <bits/stdc++.h>
using namespace std;
int n, a[500001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int minn = 0, l = -1, r = -1;
  while (l < n && r < n) {
    for (l = r + 1; l < n - 1; l++)
      if (a[l] != a[l + 1]) break;
    for (r = l + 1; r < n - 1; r++)
      if (a[r] == a[r + 1]) break;
    if (r - l + 1 < 3) continue;
    int mid = (l + r) / 2;
    for (int i = l; i <= r; i++) a[i] = i <= mid ? a[l] : a[r];
    minn = max(minn, (r - l) / 2);
  }
  cout << minn << endl;
  for (register int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
  return 0;
}
