#include <bits/stdc++.h>
using namespace std;
int a[500500], b[500500], c[500500];
int beg[500500], fin[500500];
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  b[1] = 1;
  b[n] = 1;
  for (int i = 2; i < n; i++) {
    if (a[i] == a[i + 1] || a[i] == a[i - 1])
      b[i] = 1;
    else
      b[i] = 0;
  }
  int maxi = 0, len = 0;
  for (int i = 2; i <= n; i++) {
    if (b[i] == 0)
      len++;
    else {
      maxi = max(maxi, len);
      len = 0;
    }
  }
  int indexbeg = 1, indexfin = 1;
  for (int i = 1; i < n; i++) {
    if (b[i] == 1 && b[i + 1] == 0) {
      beg[indexbeg] = i + 1;
      indexbeg++;
    }
    if (b[i] == 0 && b[i + 1] == 1) {
      fin[indexfin] = i;
      indexfin++;
    }
  }
  int index = 1;
  for (int i = 1; i <= n;) {
    if (b[i] == 1) {
      c[i] = a[i];
      i++;
    } else {
      int l = fin[index] - beg[index] + 1;
      if (l % 2 == 1)
        for (int j = i; j <= fin[index]; j++) c[j] = a[i - 1];
      else {
        for (int j = i; j <= i + (l / 2) - 1; j++) c[j] = a[i - 1];
        for (int k = i + (l / 2); k <= fin[index]; k++)
          c[k] = a[fin[index] + 1];
      }
      i = fin[index] + 1;
      index++;
    }
  }
  cout << (maxi + 1) / 2 << endl;
  for (int i = 1; i <= n; i++) printf("%d ", c[i]);
  return 0;
}
