#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
T gcd(T a, T b) {
  return ((b == 0) ? a : gcd(b, a % b));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vector<int> s;
  for (int i = (int)(1); i < (int)(n - 1); i++)
    if (a[i] != a[i - 1] && a[i] != a[i + 1]) s.push_back(i);
  int cur = ((int)s.size() ? 1 : 0);
  int mx = 0;
  for (int i = (int)(1); i < (int)(s.size()); i++) {
    if (s[i] == (s[i - 1] + 1))
      cur++;
    else {
      mx = max(mx, cur);
      cur = 1;
    }
  }
  mx = max(mx, cur);
  cout << (mx + 1) / 2 << endl;
  vector<int> b(n);
  for (int i = 0; i < (int)(n); i++) b[i] = a[i];
  int st = 0;
  cur = 0;
  for (int i = (int)(1); i < (int)(n - 1); i++) {
    if (a[i] != a[i - 1] && a[i] != a[i + 1]) {
      if (!cur) st = i;
      cur++;
    } else if (st) {
      if (a[st - 1] == a[i]) {
        for (int j = (int)(st); j < (int)(i); j++) b[j] = a[st - 1];
      } else {
        for (int j = (int)(st); j < (int)(i); j++) {
          if (abs(j - (st - 1)) < abs(j - i))
            b[j] = a[st - 1];
          else
            b[j] = a[i];
        }
      }
      st = 0;
      cur = 0;
    }
  }
  if (st) {
    int i = n - 1;
    if (a[st - 1] == a[i]) {
      for (int j = (int)(st); j < (int)(i); j++) b[j] = a[st - 1];
    } else {
      for (int j = (int)(st); j < (int)(i); j++) {
        if (abs(j - (st - 1)) < abs(j - i))
          b[j] = a[st - 1];
        else
          b[j] = a[i];
      }
    }
  }
  for (int x : b) cout << x << " ";
  cout << endl;
  return 0;
}
