#include <bits/stdc++.h>
using namespace std;
int bitct(long long r) { return r == 0 ? 0 : (bitct(r >> 1) + (r & 1)); }
long long gcd(long long x, long long y) { return x ? gcd(y % x, x) : y; }
template <typename T>
ostream& operator<<(ostream& o, vector<T> v) {
  o << "[";
  int i = 0, s = v.size();
  for (; i + 1 < s; i++) o << v[i] << ", ";
  if (s) o << v[i];
  o << "]";
  return o;
}
template <typename K, typename V>
ostream& operator<<(ostream& o, unordered_map<K, V> m) {
  o << "{";
  for (auto i : m) o << i.first << " -> " << i.second << ", ";
  o << "}";
  return o;
}
template <typename K, typename V>
ostream& operator<<(ostream& o, map<K, V> m) {
  o << "{";
  for (auto i : m) o << i.first << " -> " << i.second << ", ";
  o << "}";
  return o;
}
template <typename K, typename V>
ostream& operator<<(ostream& o, set<K> m) {
  o << "#{";
  for (auto i : m) o << i << ", ";
  o << "}";
  return o;
}
template <typename K, typename V>
ostream& operator<<(ostream& o, unordered_set<K> m) {
  o << "#{";
  for (auto i : m) o << i << ", ";
  o << "}";
  return o;
}
long long choose(long long n, long long q) {
  if (n == 0 || q == 0) return 1;
  if (q == 1)
    return n;
  else
    return (choose(n, q - 1) * (n - q + 1) / q);
}
int main() {
  long long B7 = 1000000007;
  ios_base::sync_with_stdio(false);
  long long len;
  cin >> len;
  vector<long long> b;
  for (int i = 0; i < len; i++) {
    long long bb;
    cin >> bb;
    b.push_back(bb);
  }
  b.push_back(b[b.size() - 1]);
  int worst = 0;
  int trans = -1;
  for (int i = 1; i < len + 1; i++) {
    if (b[i] != b[i - 1]) {
      if (trans == -1) trans = i - 1;
    } else {
      if (trans != -1) {
        long long dist = (i - 1 - trans) / 2;
        if (dist > worst) worst = dist;
        for (int k = trans; k <= trans + dist; k++) b[k] = b[trans];
        for (int k = trans + dist + 1; k < i; k++) b[k] = b[i];
        trans = -1;
      }
    }
  }
  cout << worst << endl;
  for (int i = 0; i < len; i++) {
    cout << b[i];
    if (i < len - 1) cout << " ";
  }
  cout << endl;
}
