#include <bits/stdc++.h>
using namespace std;
int v[505050], n;
int main() {
  scanf("%d", &n);
  for (int(i) = (1); (i) < (n + 1); (i)++) scanf("%d", v + i);
  v[0] = v[1];
  v[n + 1] = v[n];
  n += 2;
  vector<int> l, tt, r;
  int t = 0;
  for (int(i) = (1); (i) < (n - 1); (i)++)
    if (v[i] != v[i + 1] && v[i] != v[i - 1]) {
      if (!t) l.push_back(i);
      t++;
    } else {
      if (t) r.push_back(i), tt.push_back(t);
      t = 0;
    }
  if (((int)(tt).size()))
    printf("%d\n", (*max_element((tt).begin(), (tt).end()) + 1) / 2);
  else
    puts("0");
  for (int(i) = (0); (i) < (((int)(l).size())); (i)++) {
    int L = 1 - v[l[i]], R = 1 - v[r[i] - 1];
    if (tt[i] & 1)
      for (int(j) = (l[i]); (j) < (r[i]); (j)++) v[j] = L;
    else {
      for (int(j) = (l[i]); (j) < (l[i] + tt[i] / 2); (j)++) v[j] = L;
      for (int(j) = (l[i] + tt[i] / 2); (j) < (r[i]); (j)++) v[j] = R;
    }
  }
  n -= 2;
  for (int(i) = (1); (i) < (n + 1); (i)++)
    printf("%d%c", v[i], i == n ? '\n' : ' ');
}
