#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100;
int a[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int cons = 0, last = -1;
  int best = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    a[i] = x;
    if (last != -1 && x ^ last == 1) {
      cons++;
    } else {
      if (cons > 0 && (cons & 1) == 1) {
        for (int j = i - cons; j < i; j++) {
          a[j] = a[i - 1];
        }
      } else if (cons > 0 && (cons & 1) == 0) {
        int l = a[i - 1];
        int half = cons / 2;
        for (int j = i - half; j < i; j++) {
          a[j] = a[i - 1];
        }
        for (int j = i - cons; j < i - half; j++) {
          a[j] = a[i - 1] ^ 1;
        }
      }
      cons = 1;
    }
    best = max(best, cons);
    last = x;
  }
  if (cons) {
    int i = n + 1;
    if (cons & 1) {
      for (int j = i - cons; j < i; j++) {
        a[j] = a[i - 1];
      }
    } else {
      int l = a[i - 1];
      int half = cons / 2;
      for (int j = i - half; j < i; j++) {
        a[j] = a[i - 1];
      }
      for (int j = i - cons; j < i - half; j++) {
        a[j] = a[i - 1] ^ 1;
      }
    }
  }
  if (best & 1) {
    cout << best / 2;
  } else {
    cout << best / 2 - 1;
  }
  cout << endl;
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
