#include <bits/stdc++.h>
using namespace std;
const long long N = 5e5 + 5;
bool a[N];
int32_t main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long lst = 1;
  long long ans = 0, l, r;
  for (long long i = 2; i <= n + 1; i++) {
    if (a[i] == a[i - 1] or i == n + 1) {
      ans = max(ans, (i - 1 - lst) / 2);
      r = i - 2;
      l = lst + 1;
      while (l <= r) {
        a[l++] = a[lst];
        a[r--] = a[i - 1];
      }
      lst = i;
    }
  }
  cout << ans << "\n";
  for (long long i = 1; i <= n; i++) cout << a[i] << " ";
}
