#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n;
  vector<char> a(n);
  vector<int> partial(n, 0);
  for (int i = (0); i < (n); i++) cin >> a[i];
  for (int i = (1); i < (n); i++)
    if (a[i] != a[i - 1]) partial[i] = partial[i - 1] + 1;
  vector<pair<int, int> > pairs;
  int l = 0, r = 0, maxx = 0;
  for (int i = (1); i < (n); i++) {
    maxx = max(partial[i], maxx);
    if (partial[i] == 0) {
      r = i - 1;
      if (r - l >= 2) pairs.push_back(make_pair(l, r));
      l = i;
    }
  }
  if (l != n - 1) pairs.push_back(make_pair(l, n - 1));
  cout << (maxx) / 2 << '\n';
  for (int i = (0); i < (pairs.size()); i++) {
    if (a[pairs[i].first] == a[pairs[i].second]) {
      for (int j = (pairs[i].first); j < (pairs[i].second + 1); j++) {
        a[j] = a[pairs[i].first];
      }
      continue;
    }
    int mediana = (pairs[i].second + 1 - pairs[i].first) / 2;
    for (int j = (0); j < (mediana); j++)
      a[pairs[i].first + j] = a[pairs[i].first];
    for (int j = (0); j < (mediana); j++)
      a[mediana + pairs[i].first + j] = a[pairs[i].second];
  }
  for (int i = (0); i < (n); i++) cout << a[i] << " ";
  cout << '\n';
  return 0;
}
