#include <bits/stdc++.h>
using namespace std;
const long long N = 5e5 + 5;
long long n, cnt = 0;
long long a[N], ans[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) {
    long long l = i, r = i + 1;
    while (r <= n && a[l] ^ a[r]) {
      l++;
      r++;
    }
    l = i + 1;
    r -= 2;
    long long cur = 0;
    while (l <= r) {
      a[l] = a[l - 1];
      a[r] = a[r + 1];
      l++;
      r--;
      cur++;
    }
    cnt = max(cnt, cur);
  }
  cout << cnt << "\n";
  for (long long i = 1; i <= n; i++) cout << a[i] << " ";
  return 0;
}
