#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
// 讀取水晶總數
if (!(cin >> n)) return 0;
if (n <= 0) return 0;
int current_val, count = 0;
int first_val;
// 讀取第一個數字作為起始
cin >> first_val;
current_val = first_val;
count = 1;
// 從第二個數字開始檢查
for (int i = 1; i < n; ++i) {
int next_val;
cin >> next_val;
if (next_val == current_val) {
// 如果相同,共鳴長度 +1
count++;
} else {
// 如果不同,輸出前一組的長度,並重置
cout << count << " ";
current_val = next_val;
count = 1;
}
}
// 輸出最後一組的長度
cout << count << endl;
return 0;
}