#include <bits/stdc++.h>
using namespace std;
const int N = 500010;
int a[N], b[N];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    memset(b, 0, sizeof(b));
    for (int i = 1; i < n - 1; i++) b[i] = a[i] != a[i - 1] && a[i] != a[i + 1];
    int ans = 0;
    int i = 1;
    while (i < n - 1) {
      if (!b[i])
        i++;
      else {
        int j = i;
        while (b[j]) j++;
        ans = max(ans, (j - i + 1) / 2);
        if ((j - i) % 2)
          for (int k = i; k < j; k++) a[k] = a[i - 1];
        else
          for (int k = i; k < j; k++)
            a[k] = (k < (i + j) / 2) ? a[i - 1] : a[j];
        i = j;
      }
    }
    cout << ans << endl;
    for (int i = 0; i < n - 1; i++) cout << a[i] << ' ';
    cout << a[n - 1] << endl;
  }
  return 0;
}
