#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n), b;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  b = a;
  int res = 0;
  a.push_back(a[n - 1]);
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i - 1]) {
      int cnt = 1;
      int j = i + 1;
      for (; j < n; j++) {
        if (a[j] != a[j - 1]) {
          cnt++;
        } else {
          break;
        }
      }
      if (cnt == 1) continue;
      res = max(res, cnt / 2);
      if (cnt % 2 == 0) {
        for (; i < j; i++) {
          b[i] = a[j];
        }
      } else {
        int count = 0;
        int uo = a[i];
        for (; i < j; i++) {
          if (count < cnt / 2) {
            b[i] = uo ^ 1;
            count++;
          } else {
            b[i] = uo;
          }
        }
      }
    }
  }
  cout << res << "\n";
  for (int i = 0; i < n; i++) {
    cout << b[i] << " ";
  }
  cout << "\n";
}
