#include <bits/stdc++.h>
const long long inf = 9223372036854775807ll;
const int iinf = 2147483647;
const int limit = 1048576;
using namespace std;
bool sync_with_stdio(bool sync = false);
int main() {
  int n;
  scanf("%d", &n);
  vector<int> input;
  vector<pair<int, int> > seqs;
  for (int i = (int)0; i < (int)n; i++) {
    int t1;
    scanf("%d", &t1);
    input.push_back(t1);
  }
  int cnt = 0, len = 0;
  seqs.push_back({0, input[0]});
  for (int i = (int)1; i < (int)n - 1; i++) {
    if (input[i] != input[i - 1] && input[i] != input[i + 1])
      cnt++;
    else {
      seqs.push_back({i, input[i]});
      len = max(len, cnt);
      cnt = 0;
    }
  }
  seqs.push_back({n - 1, input[n - 1]});
  len = max(len, cnt);
  printf("%d\n", (len + 1) / 2);
  int k = 1;
  for (int i = (int)0; i < (int)n; i++) {
    if (i > seqs[k].first) k++;
    if (abs(i - seqs[k - 1].first) < abs(i - seqs[k].first))
      printf("%d ", seqs[k - 1].second);
    else
      printf("%d ", seqs[k].second);
  }
  return 0;
}
