#include <bits/stdc++.h>
using namespace std;
int A[500000 + 5];
int solve(int n) {
  if (n == 0) return 0;
  return ((n - 1) >> 1) + 1;
}
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < (n); i++) scanf("%d", &A[i]);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      int ind;
      for (int j = i; j < n; ++j)
        if (A[i] == A[j])
          ind = j;
        else
          break;
      if (i == 0 || ind == n - 1 || i != ind) {
        i = ind;
        continue;
      }
      int target = A[i];
      for (int j = i; j < n; ++j) {
        if (A[j] == target)
          ind = j;
        else
          break;
        target ^= 1;
      }
      ind--;
      target = A[i];
      int len = ind - i + 1;
      ans = max(ans, solve(len));
      if (len & 1) {
        for (int k = 0; k < (len); k++) A[i + k] = target ^ 1;
      } else {
        for (int k = 0; k < (len >> 1); k++) A[i + k] = target ^ 1;
        for (int k = 0; k < (len >> 1); k++) A[i + (len >> 1) + k] = target;
      }
      i = ind;
    }
    printf("%d\n", ans);
    for (int i = 0; i < (n); i++) printf("%d%c", A[i], (i + 1 == n ? 10 : 32));
  }
}
