#include <bits/stdc++.h>
using namespace std;
int a[5005];
int cnt[5005];
int ans[5005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    cnt[5005] = {};
    int idx;
    int prev = 0;
    mx = -10;
    memset(cnt, 0, sizeof(cnt));
    for (int j = i; j <= n; j++) {
      cnt[a[j]]++;
      if (cnt[a[j]] > mx || cnt[a[j]] == mx && idx > a[j]) {
        mx = cnt[a[j]];
        idx = a[j];
      }
      ans[idx]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
}
