#include <bits/stdc++.h>
using namespace std;
int a[500010];
int b[500010];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      int j;
      for (j = i + 1; j < n && a[j - 1] != a[j]; ++j) {
      }
      if (j - i <= 2) {
        continue;
      }
      if (a[j - 1] == a[i]) {
        for (int k = i; k < j; ++k) {
          a[k] = a[i];
        }
      } else {
        for (int k = i; k < i + (j - i) / 2; ++k) {
          a[k] = a[i];
        }
        for (int k = i + (j - i) / 2; k < j; ++k) {
          a[k] = a[j - 1];
        }
      }
      cnt = max(cnt, (j - 1 - i) / 2);
    }
    printf("%d\n", cnt);
    for (int i = 0; i < n; i++) {
      printf("%d ", a[i]);
    }
    puts("");
  }
  return 0;
}
