#include <bits/stdc++.h>
using namespace std;
const long long int inf = 0x3f3f3f3f3f3f3f3fll;
const int maxx = INT_MAX;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[n + 2];
  int un[n + 2];
  memset(un, 0, sizeof(un));
  vector<int> st;
  for (int i = 1; i <= n; i++) cin >> a[i];
  st.push_back(1);
  for (int i = 2; i < n; i++) {
    int fre[2] = {0};
    memset(fre, 0, sizeof(fre));
    for (int j = i - 1; j <= i + 1; j++) fre[a[j]]++;
    if (fre[a[i]] >= 2)
      st.push_back(i);
    else
      un[i] = 1;
  }
  st.push_back(n);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (un[i] == 0) continue;
    int r = upper_bound(st.begin(), st.end(), i) - st.begin();
    int l = st[r - 1], u = st[r];
    int mn = min(abs(i - l), abs(u - i));
    if (abs(i - l) == mn)
      a[i] = a[l];
    else
      a[i] = a[u];
    ans = max(ans, mn);
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  cout << endl;
  return 0;
}
