#include
using namespace std;
int main() {
short n, maxl = 0, l = 0;
short * a;
cin >> n;
if (n < 0)
return 1;
else
a = new short[n];
for (short i = 0; i < n; i++)
cin >> a[i];
for (short i = 0; i < n; i++) {
if (l == 0)
l++;
else if (a[i - 1] == a[i])
l++;
else if (maxl < l) {
maxl = l;
l = 1;
}
else l = 1;
}
if (maxl < l)
maxl = l;
cout << maxl << endl;</p>
for (short i = 0; i < n; i++)
cout << a[i] << " ";</p>
delete[] a;
return 0;
}