#include <bits/stdc++.h>
using namespace std;
unsigned int n;
unsigned int a[5001];
unsigned int dom[5001][5001];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    unsigned int cnt[5001] = {0};
    cnt[a[i]]++;
    dom[i][i] = a[i];
    int dmn = a[i];
    for (int j = i + 1; j <= n; j++) {
      cnt[a[j]]++;
      if (cnt[a[j]] > cnt[dmn] || (cnt[a[j]] == cnt[dmn] && a[j] < dmn))
        dmn = a[j];
      dom[i][j] = dmn;
    }
  }
  int res[5001] = {0};
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) res[dom[i][j]]++;
  for (int i = 1; i <= n; i++) cout << res[i] << " ";
  return 0;
}
