#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4786)
int a[1000002], n, nn;
pair<int, int> b[1000002];
int main() {
  int i, j, k, res, pre, cnt;
  while (scanf("%d", &n) == 1) {
    for (i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    a[0] = a[1];
    a[n + 1] = a[n];
    n++;
    b[0].first = a[0];
    b[0].second = 1;
    nn = 0;
    for (i = 1; i <= n; i++) {
      if (a[i] == b[nn].first) {
        b[nn].second++;
      } else {
        b[++nn].first = a[i];
        b[nn].second = 1;
      }
    }
    res = 0;
    k = 0;
    for (i = 0; i <= nn; i++) {
      if (b[i].second > 1) {
        for (j = 0; j < b[i].second; j++) {
          a[k++] = b[i].first;
        }
        continue;
      }
      pre = b[i - 1].first;
      cnt = 0;
      for (; i < nn; i++) {
        if (b[i].second == 1) {
          cnt++;
        } else {
          break;
        }
      }
      if (cnt & 1)
        for (j = 0; j < cnt; j++) a[k++] = pre;
      else {
        for (j = 0; j < cnt / 2; j++) a[k++] = pre;
        for (; j < cnt; j++) a[k++] = 1 - pre;
      }
      i--;
      res = ((res) > (((cnt + 1) / 2)) ? (res) : (((cnt + 1) / 2)));
    }
    printf("%d\n", res);
    for (i = 1; i < n; i++) {
      if (i > 1) printf(" ");
      printf("%d", a[i]);
    }
    puts("");
  }
  return 0;
}
