#include <bits/stdc++.h>
using namespace std;
const int N = 2e6;
int n, a[N], c[N], ans[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    int cnt = 0;
    int id = -1;
    fill(c + 1, c + n + 1, 0);
    for (int j = i; j < n; ++j) {
      c[a[j]]++;
      if (c[a[j]] > cnt || (c[a[j]] == cnt && a[j] < id)) {
        cnt = c[a[j]];
        id = a[j];
      }
      ans[id]++;
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << ' ';
  }
  return 0;
}
