#include <bits/stdc++.h>
using namespace std;
int a[500005], b[500005];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int k = 0, tot = 1, st = -1;
  b[0] = a[0], b[n - 1] = a[n - 1];
  int maxn = 0;
  for (int i = 1; i < n - 1; i++) {
    if (a[i] != a[i - 1] && a[i + 1] != a[i] && st == -1) {
      st = a[i - 1];
      k++;
    } else if (a[i] != a[i - 1] && a[i + 1] != a[i]) {
      k++;
    } else if (k) {
      int ed = a[i + 1];
      if (k % 2 == 1) {
        for (int i = 0; i < k; i++) {
          b[tot++] = st;
        }
        maxn = max(maxn, k / 2 + 1);
      } else {
        for (int i = 0; i < k / 2; i++) {
          b[tot++] = st;
        }
        for (int i = 0; i < k / 2; i++) {
          b[tot++] = ed;
        }
        maxn = max(maxn, k / 2);
      }
      k = 0;
      st = -1;
      b[tot++] = a[i];
    } else {
      b[tot++] = a[i];
    }
  }
  if (k) {
    int ed = a[n - 1];
    if (k % 2 == 1) {
      for (int i = 0; i < k; i++) {
        b[tot++] = st;
      }
      maxn = max(maxn, k / 2 + 1);
    } else {
      for (int i = 0; i < k / 2; i++) {
        b[tot++] = st;
      }
      for (int i = 0; i < k / 2; i++) {
        b[tot++] = ed;
      }
      maxn = max(maxn, k / 2);
    }
    k = 0;
    st = -1;
  }
  cout << maxn << endl;
  for (int i = 0; i < n; i++) cout << b[i] << " ";
}
