#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
int n;
int arr[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%d", &arr[i]);
  int ans = 0;
  for (int i = 1; i < n - 1; ++i) {
    if (arr[i] != arr[i - 1] && arr[i] != arr[i + 1]) {
      int j;
      for (j = i + 1; j < n - 1 && arr[j] != arr[j - 1] && arr[j] != arr[j + 1];
           ++j)
        ;
      if (arr[i - 1] == arr[j]) {
        for (int k = i; k < j; ++k) arr[k] = arr[j];
      } else {
        int l = i, r = j - 1;
        while (l < r) {
          arr[l++] = arr[i - 1];
          arr[r--] = arr[j];
        }
      }
      ans = max(ans, (j - i + 1) / 2);
      i = j;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n; ++i) printf("%d ", arr[i]);
  cout << endl;
  return 0;
}
