#include <bits/stdc++.h>
using namespace std;
const int N = 300200;
const int mod = 1000000007;
const int SN = 1 << 18;
long long int n;
long long int ar[N];
long long int best;
long long int cnt[N];
long long int ans[N];
int main() {
  cin >> n;
  for (long long int i = 0; i < n; i++) cin >> ar[i];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j <= n; j++) cnt[j] = 0;
    for (long long int k = i; k < n; k++) {
      long long int val = ar[k];
      cnt[val]++;
      if (cnt[val] > cnt[best] || (cnt[val] == cnt[best] && val < best))
        best = val;
      ans[best]++;
    }
  }
  for (long long int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
