#include <bits/stdc++.h>
using namespace std;
long long mod = 1e6 + 100;
long long ind1 = 0, ind2 = 0;
map<long long, bool> mp;
map<long long, bool>::iterator it, titr;
vector<long long> v;
char second[500010];
int main() {
  int n;
  cin >> n;
  string ans = "";
  for (int i = 0; i < n; i++) cin >> second[i];
  int st = 0, vx = -1;
  for (long long i = 0; i <= n - 1; i++) {
    if (i == 0 && second[0] == '0') {
      mp[i] = false;
    } else if (i == n - 1) {
      if (second[i] == '0')
        mp[i] = false;
      else
        mp[i] = true;
    } else if (i == 0 && second[0] == '1') {
      mp[i] = true;
    } else if (second[i] == '1' &&
               (second[i + 1] == '1' || second[i - 1] == '1')) {
      mp[i] = true;
    } else if (second[i] == '0' &&
               (second[i + 1] == '0' || second[i - 1] == '0')) {
      mp[i] = false;
    }
  }
  long long mx = -1;
  it = mp.begin();
  char val1, val2;
  while (it != mp.end()) {
    int x = it->first;
    int y = it->second;
    it++;
    if (it == mp.end()) break;
    val1 = y + '0', val2 = it->second + '0';
    int z = it->first - x + 1;
    z /= 2;
    mx = max(mx, (it->first - x) / 2);
    z += x;
    int i;
    for (i = x; i < z; i++) ans += val1;
    for (int j = i; j < it->first; j++) ans += val2;
  }
  ans += second[n - 1];
  cout << mx << "\n";
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
}
