#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
long long v[100000];
vector<long long> V[200005];
long long sum[200005] = {0}, l[5005], r[5005], ans[5005];
int main() {
  long long int n, k, q, i, j, a, b, d, l1, t, sm = 0;
  cin >> t;
  for (i = 1; i <= t; i++) {
    cin >> l[i];
  }
  for (i = 1; i <= t; i++) {
    memset(r, 0, sizeof(r));
    long long mx = 0, w = -1;
    for (j = i; j <= t; j++) {
      r[l[j]]++;
      if (r[l[j]] > mx) {
        mx = r[l[j]];
        w = l[j];
      } else if (r[l[j]] == mx && w > l[j]) {
        w = l[j];
      }
      ans[w]++;
    }
  }
  for (i = 1; i <= t; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
