#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
ostream &operator<<(ostream &out, pair<T, T1> obj) {
  return out << "(" << obj.first << "," << obj.second << ")";
}
template <typename T, typename T1>
ostream &operator<<(ostream &out, map<T, T1> cont) {
  typename map<T, T1>::const_iterator itr = cont.begin();
  typename map<T, T1>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
}
template <typename T>
ostream &operator<<(ostream &out, set<T> cont) {
  typename set<T>::const_iterator itr = cont.begin();
  typename set<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
}
template <typename T>
ostream &operator<<(ostream &out, multiset<T> cont) {
  typename multiset<T>::const_iterator itr = cont.begin();
  typename multiset<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
}
template <typename T,
          template <typename ELEM, typename ALLOC = allocator<ELEM>> class CONT>
ostream &operator<<(ostream &out, CONT<T> cont) {
  typename CONT<T>::const_iterator itr = cont.begin();
  typename CONT<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
}
template <typename T, unsigned int N, typename CTy, typename CTr>
typename enable_if<!is_same<T, char>::value, basic_ostream<CTy, CTr> &>::type
operator<<(basic_ostream<CTy, CTr> &out, const T (&arr)[N]) {
  for (auto i = 0 - (0 > N); i != N - (0 > N); i += 1 - 2 * (0 > N))
    out << arr[i] << " ";
  out << endl;
}
template <typename T>
T gcd(T a, T b) {
  T min_v = min(a, b);
  T max_v = max(a, b);
  while (min_v) {
    T temp = max_v % min_v;
    max_v = min_v;
    min_v = temp;
  }
  return max_v;
}
template <typename T>
T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
template <typename T>
T fast_exp_pow(T base, T exp, T mod) {
  long long res = 1;
  while (exp) {
    if (exp & 1) {
      res *= base;
      res %= mod;
    }
    exp >>= 1;
    base *= base;
    base %= mod;
  }
  return res;
}
int N, curr, maxim;
int initial[500010], result[500010];
vector<int> keep;
int main() {
  scanf("%d", &N);
  for (auto i = 0 - (0 > N); i != N - (0 > N); i += 1 - 2 * (0 > N))
    scanf("%d", initial + i);
  keep.push_back(0);
  for (int i = 1; i < N - 1; ++i) {
    if (initial[i] != initial[i - 1] && initial[i] != initial[i + 1]) {
      ++curr;
      maxim = max(maxim, curr);
      continue;
    }
    keep.push_back(i);
    curr = 0;
  }
  keep.push_back(N - 1);
  maxim = (maxim + 1) / 2;
  for (auto i = 0 - (0 > (int)keep.size() - 1);
       i != (int)keep.size() - 1 - (0 > (int)keep.size() - 1);
       i += 1 - 2 * (0 > (int)keep.size() - 1)) {
    for (int j = keep[i]; j <= keep[i + 1]; ++j) {
      if (j - keep[i] >= keep[i + 1] - j)
        result[j] = initial[keep[i + 1]];
      else
        result[j] = initial[keep[i]];
    }
  }
  printf("%d\n", maxim);
  for (auto i = 0 - (0 > N); i != N - (0 > N); i += 1 - 2 * (0 > N))
    printf("%d ", result[i]);
  return 0;
}
