#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int st[1000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  st[1] = st[n] = 1;
  for (int i = 2; i < n; ++i)
    if (a[i - 1] == a[i] || a[i] == a[i + 1]) st[i] = 1;
  for (int i = 1; i < n; ++i) {
    if (st[i] == 1 && st[i + 1] == 0) {
      int j = i + 1;
      while (st[j] == 0) j++;
      int l = j - i + 1, can;
      if (l & 1)
        can = (l - 1) / 2;
      else
        can = l / 2 - 1;
      cnt = max(cnt, can);
      if (l & 1)
        for (int k = i; k <= j; k++) a[k] = a[i];
      else
        for (int k = i; k <= j; k++)
          if (k <= (i + j) / 2)
            a[k] = a[i];
          else
            a[k] = a[j];
    }
  }
  cout << cnt << endl;
  for (int i = 1; i <= n; ++i) cout << a[i] << " ";
  return 0;
}
