#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int x;
  int a[N + 5];
  for (int n = 0; n < N; ++n) {
    scanf("%d", &a[n]);
  }
  a[N] = a[N - 1];
  int Ans = 0;
  for (int n = 1; n < N - 1;) {
    if (a[n] == a[n - 1]) {
      ++n;
      continue;
    }
    int m = n;
    int tc = 1;
    while (m < N - 1 && a[m] != a[m + 1]) {
      ++m;
      ++tc;
    }
    if (a[n - 1] != a[m + 1]) {
      int dx = (tc / 2);
      for (int i = 0; i < dx; ++i) {
        a[n + i] = a[n - 1];
      }
      for (int i = 0; i < dx; ++i) {
        a[m - 1 - i] = a[m + 1];
      }
    } else {
      for (int i = n; i < m; ++i) {
        a[i] = a[n - 1];
      }
    }
    Ans = max(Ans, (tc) / 2);
    n = m + 1;
  }
  cout << Ans << endl;
  for (int n = 0; n < N; ++n) {
    if (n == N - 1) {
      cout << a[n] << endl;
    } else {
      cout << a[n] << " ";
    }
  }
  return 0;
}
