#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (auto& x : a) cin >> x;
  b[0] = b.back() = 1;
  for (int i = 1; i < n; ++i)
    if (a[i] == a[i - 1]) b[i] = 1;
  for (int i = n - 2; i >= 0; --i)
    if (a[i] == a[i + 1]) b[i] = 1;
  int ans = 0;
  for (int i = 0, j = 0; i < n; i = j) {
    while (j < n && b[i] == b[j]) j++;
    if (b[i] == 0) {
      ans = max(ans, (j - i + 1) / 2);
      int l = i;
      int r = j - 1;
      while (l <= r) {
        a[l++] = a[i - 1];
        a[r--] = a[j];
      }
    }
  }
  cout << ans << '\n';
  for (auto x : a) cout << x << ' ';
}
