#include <bits/stdc++.h>
using namespace std;
const int MN = 5e5 + 100;
int t[MN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
  }
  int b = 0;
  int ma = 0;
  for (; b < n; ++b) {
    if (b == n - 1 || t[b] != t[b + 1]) break;
  }
  while (b < n - 1) {
    int x = 0;
    for (x = b + 1; x < n; ++x) {
      if (x == n - 1 || t[x] == t[x + 1]) break;
    }
    if (x == b + 1) {
      ++b;
      for (; b < n; ++b) {
        if (b == n - 1 || t[b] != t[b + 1]) break;
      }
    }
    if (t[b] != t[x]) {
      ma = max(ma, (x - b) / 2);
      for (int i = 0; i < (x - b) / 2; ++i) {
        t[b + i + 1] = t[b];
        t[x - i - 1] = t[x];
      }
      for (; b < n; ++b) {
        if (b == n - 1 || t[b] != t[b + 1]) break;
      }
    } else {
      ma = max(ma, (x - b) / 2);
      for (int i = b; i < x; ++i) {
        t[i] = t[b];
      }
      for (; b < n; ++b) {
        if (b == n - 1 || t[b] != t[b + 1]) break;
      }
    }
  }
  cout << ma << '\n';
  for (int i = 0; i < n; ++i) {
    cout << t[i] << ' ';
  }
  cout << '\n';
}
