#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> col(n);
  for (int i = 0; i < n; ++i) {
    cin >> col[i];
  }
  vector<int> ans(n, 0);
  for (int i = 0; i < n; ++i) {
    vector<int> curr_ans(n, 0);
    int best_col = -1, best = 0;
    for (int j = i; j < n; ++j) {
      ++curr_ans[col[j] - 1];
      if (curr_ans[col[j] - 1] > best ||
          curr_ans[col[j] - 1] == best && col[j] - 1 < best_col) {
        best = curr_ans[col[j] - 1];
        best_col = col[j] - 1;
      }
      ++ans[best_col];
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << ' ';
  }
  cout << endl;
  return 0;
}
