#include <bits/stdc++.h>
using namespace std;
int a[500008], n;
int slove(int x, int y) {
  int k = y - x + 1;
  int i;
  if (k % 2 == 0) {
    for (i = x; i < x + k / 2; i++) {
      a[i] = a[x];
    }
    for (i = x + k / 2; i <= y; i++) {
      a[i] = a[y];
    }
  } else {
    for (i = x + 1; i <= y; i++) {
      a[i] = a[x];
    }
  }
  return (k - 1) / 2;
}
int main() {
  int ans, l, r;
  int i;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  ans = 0;
  for (i = 2; i < n; i++) {
    if (a[i] != a[i - 1] && a[i] != a[i + 1]) {
      l = i - 1;
      i++;
      for (; i < n; i++) {
        if (a[i] != a[i - 1] && a[i] != a[i + 1]) {
          continue;
        } else {
          break;
        }
      }
      r = i;
      ans = max(ans, slove(l, r));
      l = 0;
      r = 0;
    }
  }
  cout << ans << endl;
  for (i = 1; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << a[i] << endl;
}
