#include <bits/stdc++.h>
using namespace std;
int a[500001];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int i = 1;
  int ans = 0;
  while (i < n - 1)
    if (a[i] != a[i - 1] && a[i] != a[i + 1]) {
      int j = i;
      while (j < n && a[j] != a[j + 1]) j++;
      if (j == n) j--;
      if (a[i] != a[j]) {
        for (int k = i; k < j; k++) a[k] = a[j];
        ans = max(ans, (j - i) / 2 + 1);
      } else {
        for (int k = i; k < (i + j) / 2; k++) a[k] = a[i - 1];
        for (int k = (i + j) / 2; k < j; k++) a[k] = a[j];
        ans = max(ans, (j - i) / 2);
      }
      i = j;
    } else
      i++;
  cout << ans << endl;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
