#include <bits/stdc++.h>
const int inf = 1e+9;
using namespace std;
int a[500010];
int main() {
  int n;
  cin >> n;
  int ans = 0;
  int max = 0;
  bool ok;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n - 1; i++) {
    ok = 0;
    int ans = 0;
    while (a[i + 1 + ans] != a[i + ans] && i + 1 + ans <= n) {
      ok = 1;
      ans++;
    }
    if (ok) {
      for (int j = i + 1; j <= i + ans / 2; j++) {
        a[j] = a[j - 1];
      }
      for (int j = i + ans - 1; j > i + ans / 2; j--) {
        a[j] = a[j + 1];
      }
      i = i + ans;
      max = std::max(max, ans / 2);
    }
  }
  cout << max << endl;
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
  return 0;
}
