#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v;
void print(vector<int> &v) {
  for (int i = 1; i <= n; i++) cout << v[i] << ' ';
  cout << '\n';
}
bool same(vector<int> &a, vector<int> &b) {
  for (int i = 1; i <= n; i++)
    if (a[i] != b[i]) return false;
  return true;
}
pair<int, vector<int>> brutesolve(vector<int> v) {
  int it = -1;
  vector<int> oldv;
  do {
    oldv = v;
    for (int i = 1; i <= n; i++) {
      v[i] = (oldv[i - 1] + oldv[i] + oldv[i + 1]) / 2;
    }
    it++;
  } while (!same(v, oldv));
  return {it, v};
}
pair<int, vector<int>> solve(vector<int> v) {
  int l = 0, beg = 1e9, ans = 0;
  for (int i = 1; i <= n; i++) {
    if (v[i] != v[i + 1]) {
      l++;
      beg = min(i, beg);
    } else if (l) {
      int len = i - beg + 1;
      ans = max(ans, (len - 1) / 2);
      if (v[beg] == v[i]) {
        for (int j = beg; j <= i; j++) v[j] = v[beg];
      } else {
        if (len % 2 == 0) {
          for (int j = beg; j < beg + len / 2; j++) v[j] = v[beg];
          for (int j = beg + len / 2; j < i; j++) v[j] = v[i];
        } else {
          for (int j = beg; j < beg + len / 2; j++) v[j] = v[beg];
          v[beg + len / 2] = v[beg + 1];
          for (int j = beg + len / 2 + 1; j < i; j++) v[j] = v[i];
        }
      }
      l = 0;
      beg = 1e9;
    }
  }
  return {ans, v};
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (true) {
    cin >> n;
    v.resize(n + 2);
    for (int i = 1; i <= n; i++) cin >> v[i];
    v[0] = v[1];
    v[n + 1] = v[n];
  } else {
    int t;
    cin >> t;
    while (t--) {
      n = 1 + rand() % 1111;
      v.resize(n + 2);
      for (int i = 1; i <= n; i++) v[i] = rand() % 2;
      v[0] = v[1];
      v[n + 1] = v[n];
    }
  }
  pair<int, vector<int>> a = solve(v);
  cout << a.first << '\n';
  print(a.second);
}
