#include <bits/stdc++.h>
using namespace std;
int arr[500010];
int main(void) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int max = 0;
  for (int i = 0; i < n; i++) {
    while (arr[i] == arr[i + 1]) {
      i++;
      if (i == n - 1) break;
    }
    int left = i;
    int right = left + 1;
    for (right = left + 1; right < n; right++) {
      if (arr[right] == arr[right + 1]) break;
      if (right == n - 1) break;
    }
    for (int j = left; j <= right; j++) {
      if (j <= (left + right) / 2)
        arr[j] = arr[left];
      else
        arr[j] = arr[right];
    }
    if (max < (right - left) / 2) max = (right - left) / 2;
    i = right;
  }
  cout << max << endl;
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << endl;
  return 0;
}
