#include <bits/stdc++.h>
using namespace std;
int n;
int a[500055];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  vector<int> vec;
  for (int i = 1; i + 1 < n; i++) {
    if (a[i] != a[i - 1] && a[i] != a[i + 1]) {
      vec.push_back(i);
    }
  }
  int res = 0;
  for (int i = 0; i < (int)vec.size(); i++) {
    int j = i;
    while (j + 1 < (int)vec.size() && vec[j + 1] == vec[j] + 1) j++;
    res = max(res, (j - i + 2) / 2);
    int l = i, r = j;
    while (l <= r) {
      a[vec[l]] = a[vec[l] - 1];
      a[vec[r]] = a[vec[r] + 1];
      l++, r--;
    }
    i = j;
  }
  cout << res << endl;
  for (int i = 0; i < n; i++) {
    if (i) printf(" ");
    printf("%d", a[i]);
  }
  puts("");
  return 0;
}
