#include <bits/stdc++.h>
using namespace std;
void solve(istream& in, ostream& out);
int main() {
  ios::sync_with_stdio(false);
  solve(cin, cout);
  return 0;
}
void solve(istream& in, ostream& out) {
  int n = 0;
  in >> n;
  int prev = 0;
  in >> prev;
  int len = 1;
  vector<int> res;
  int ans = 0;
  for (int i = 1; i < n; ++i) {
    int curr = 0;
    in >> curr;
    if (curr != prev) {
      ++len;
    } else {
      if (len >= 3) {
        ans = max(ans, (len - 1) / 2);
      }
      if (len % 2 == 0) {
        for (int j = 0; j < len / 2; ++j) {
          res.push_back(1 - prev);
        }
        for (int j = 0; j < len / 2; ++j) {
          res.push_back(prev);
        }
      } else {
        for (int j = 0; j < len; ++j) {
          res.push_back(prev);
        }
      }
      len = 1;
    }
    prev = curr;
  }
  if (len >= 3) {
    ans = max(ans, (len - 1) / 2);
  }
  if (len % 2 == 0) {
    for (int j = 0; j < len / 2; ++j) {
      res.push_back(1 - prev);
    }
    for (int j = 0; j < len / 2; ++j) {
      res.push_back(prev);
    }
  } else {
    for (int j = 0; j < len; ++j) {
      res.push_back(prev);
    }
  }
  out << ans << '\n';
  for (int i = 0; i < n; ++i) {
    out << res[i];
    if (i + 1 < n) {
      out << ' ';
    }
  }
  out << '\n';
}
