#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> mp;
int ar[5009], ans[5009], cnt[5009];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> ar[i];
  for (int i = 1; i <= n; i++) {
    int mn = 1000000, cl = 0;
    for (int j = 1; j <= n; j++) cnt[j] = 0;
    for (int j = i; j <= n; j++) {
      int p = ar[j];
      cnt[p]--;
      if (cnt[p] < mn) {
        mn = cnt[p];
        cl = p;
      } else if (cnt[p] == mn) {
        if (p < cl) cl = p;
      }
      ans[cl]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
}
