#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 500100;
struct Input {
  int n;
  int a[N];
  bool read() {
    if (scanf("%d", &n) != 1) return 0;
    for (int i = int(0); i < int(n); ++i) scanf("%d", &a[i]);
    return 1;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  int res;
  int ans[N];
  void write() {
    cout << res << endl;
    for (int i = int(0); i < int(n); ++i) {
      printf("%d ", ans[i]);
    }
    cout << endl;
  }
  virtual void solve() {}
  virtual void clear() { *this = Data(); }
};
struct Solution : Data {
  void solve() {
    for (int i = int(0); i < int(n); ++i) {
      ans[i] = a[i];
    }
    res = 0;
    for (int i = 0; i < n; ++i) {
      if (i == 0 || i == n - 1 || a[i] == a[i - 1]) {
        continue;
      }
      int j = i;
      for (; j < n - 1 && (abs(a[i] - a[j]) == ((j - i) & 1)); ++j)
        ;
      if (a[j] == a[j - 1]) {
        --j;
      }
      int u = a[i - 1], v = a[j];
      umx(res, (j - i + 1) / 2);
      if (u == v) {
        for (int k = i; k < j; ++k) ans[k] = u;
      } else {
        for (int k = i, p = j - 1; k < p; ++k, --p) {
          ans[k] = u, ans[p] = v;
        }
      }
      i = j;
    }
  }
  void clear() { *this = Solution(); }
};
Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
