#include <bits/stdc++.h>
using namespace std;
int main() {
  if (0) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  int t = 1;
  if (t == 0) scanf("%d", &t);
  for (int ti = 1; ti <= t; ti++) {
    int n;
    cin >> n;
    int A[n];
    for (int i = 0; i < n; i++) cin >> A[i];
    int cnt = 0;
    int s = 0;
    vector<pair<int, int> > V;
    int sum = 0;
    for (int i = 1; i <= n - 1; i++) {
      if (A[i] == A[i - 1]) {
        if (i - 1 > s + 1) V.push_back(make_pair(s, i - 1));
        s = i;
      }
    }
    if (A[n - 1] != A[n - 2]) {
      if (n - 1 > s + 1) V.push_back(make_pair(s, n - 1));
    }
    for (int i = 0; i < ((int)V.size()); i++) {
      int x = V[i].first;
      int y = V[i].second;
      int ans = (y - x) / 2;
      sum = max(sum, ans);
      if (A[x] == A[y]) {
        for (int j = x + 1; j <= y - 1; j++) {
          A[j] = A[x];
        }
      } else {
        int m = (x + y) / 2;
        for (int j = x + 1; j <= m; j++) {
          A[j] = A[x];
        }
        for (int j = m + 1; j <= y - 1; j++) {
          A[j] = A[y];
        }
      }
    }
    cout << sum << endl;
    for (int i = 0; i < n; i++) cout << A[i] << " ";
    cout << endl;
  }
  return 0;
}
