#include <bits/stdc++.h>
using namespace std;
char arr[500001];
char inv(char temp) {
  if (temp == '0') return '1';
  return '0';
}
string invert(string temp) {
  int n = temp.length();
  if (n % 2 == 1) {
    for (int i = 1; i < n; i += 2) temp[i] = inv(temp[i]);
  } else {
    for (int i = 1; i < n / 2; i += 2) temp[i] = inv(temp[i]);
    for (int i = n - 2; i >= n / 2; i -= 2) temp[i] = inv(temp[i]);
  }
  return temp;
}
int main() {
  string ans = "", cur;
  int n, a, b, c, i, j, temp = 1;
  long long res = 0;
  cin >> n;
  cin >> arr[0];
  cur = arr[0];
  for (i = 1; i < n; i++) {
    cin >> arr[i];
    if (arr[i] != arr[i - 1]) {
      temp++;
      cur += arr[i];
    } else {
      if (temp <= 2)
        ans += cur;
      else {
        res = fmax(res, (cur.length() - 1) / 2);
        ans += invert(cur);
      }
      temp = 1;
      cur = arr[i];
    }
  }
  if (temp <= 2)
    ans += cur;
  else {
    ans += invert(cur);
    res = fmax(res, (cur.length() - 1) / 2);
  }
  cout << res << endl;
  for (i = 0; i < ans.size(); i++) cout << ans[i] << " ";
}
