#include <bits/stdc++.h>
using namespace std;
int a[500000], r[500000];
int main() {
  ios::sync_with_stdio(0);
  int n;
  while (cin >> n) {
    for (int i = 0; i < n; i++) cin >> a[i];
    r[0] = a[0];
    r[n - 1] = a[n - 1];
    for (int i = 1; i < n - 1; i++) {
      int z = 0;
      for (int j = i - 1; j <= i + 1; j++)
        if (!a[j]) z++;
      r[i] = (z < 2);
    }
    int mx = 0;
    int ind1 = 1;
    while (ind1 < n - 1) {
      while (ind1 < n - 1 && a[ind1] == r[ind1]) ind1++;
      if (ind1 == n - 1) break;
      int ind2 = ind1 + 1;
      while (ind2 < n && a[ind2] != r[ind2]) ind2++;
      mx = max(mx, (ind2 - ind1 + 1) / 2);
      int ind3 = ind1 + 1, ind4 = ind2 - 2;
      while (ind3 <= ind4) {
        r[ind3] = r[ind3 - 1];
        r[ind4] = r[ind4 + 1];
        ind3++;
        ind4--;
      }
      ind1++;
    }
    cout << mx << "\n" << r[0];
    for (int i = 1; i < n; i++) cout << " " << r[i];
    cout << "\n";
  }
  return 0;
}
