#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> c(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &c[i]);
  }
  vector<int> ans(n + 1, 0);
  for (int i = 0; i < n; ++i) {
    vector<int> mx(n + 1, 0);
    int p = 0;
    for (int k = i; k < n; ++k) {
      mx[c[k]] += 1;
      if (mx[c[k]] > mx[p]) {
        p = c[k];
      } else if (mx[c[k]] == mx[p]) {
        p = min(p, c[k]);
      }
      ans[p] += 1;
    }
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d ", ans[i]);
  }
  return 0;
}
