#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
T gcd(T a, T b) {
  a = abs(a), b = abs(b);
  while (b > 0) {
    tie(a, b) = make_pair(b, a % b);
  }
  return a;
}
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
constexpr int MAX = 5000000;
vector<pair<int, long long>> RLE(vector<int>& s) {
  long long cnt = 0;
  vector<pair<int, long long>> res;
  for (long long i = 0; i < s.size(); i++) {
    cnt++;
    if (i == (long long)s.size() - 1) {
      res.push_back(make_pair(s[i], cnt));
      break;
    }
    if (s[i] != s[i + 1]) {
      res.push_back(make_pair(s[i], cnt));
      cnt = 0;
    }
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  a[0] = a[1];
  a.emplace_back(a[n]);
  auto vp = RLE(a);
  vector<int> v;
  vector<int> res;
  int mx = 0;
  for (auto p : vp) {
    if (p.second == 1) {
      v.emplace_back(p.first);
    } else {
      if (!v.empty()) {
        chmax(mx, (int)(v.size() + 1) / 2);
        if (v[0] == v.back()) {
          for (int i = 0; i < v.size(); i++) {
            res.emplace_back(v[0] ^ 1);
          }
        } else {
          for (int i = 0; i < v.size() / 2; i++) {
            res.emplace_back(v[0] ^ 1);
          }
          for (int i = v.size() / 2; i < v.size(); i++) {
            res.emplace_back(v[0]);
          }
        }
        v.clear();
      }
      for (int i = 0; i < p.second; i++) {
        res.emplace_back(p.first);
      }
    }
  }
  cout << mx << "\n";
  for (int i = 1; i <= n; i++) cout << res[i] << " \n"[i == n];
  return 0;
}
