#include <bits/stdc++.h>
using namespace std;
long long int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
void solve() {
  int n, cnt = 0;
  cin >> n;
  vector<int> v(n), leftStable(n), rightStable(n), isStable(n, 0);
  for (int i = 0; i < n; i++) cin >> v[i];
  leftStable[0] = 0, rightStable[n - 1] = n - 1;
  isStable[0] = isStable[n - 1] = 1;
  for (int i = 0; i < n; i++)
    if (v[i] == v[i + 1]) isStable[i] = isStable[i + 1] = 1;
  for (int i = 1; i <= n - 1; i++) {
    if (isStable[i])
      leftStable[i] = i;
    else
      leftStable[i] = leftStable[i - 1];
  }
  for (int i = n - 2; i >= 0; i--) {
    if (isStable[i])
      rightStable[i] = i;
    else
      rightStable[i] = rightStable[i + 1];
  }
  for (int i = 1; i < n - 1; i++) {
    if (abs(i - leftStable[i]) > abs(rightStable[i] - i))
      v[i] = v[rightStable[i]];
    else
      v[i] = v[leftStable[i]];
    cnt = max(cnt, min(abs(i - leftStable[i]), abs(rightStable[i] - i)));
  }
  cout << cnt << '\n';
  for (int i = 0; i < n; i++) cout << v[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
