#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    int n;
    cin >> n;
    vector<long long int> t(n);
    for (long long int i = 0; i < n; i++) cin >> t[i];
    vector<long long int> ans(n + 1, 0), f(n + 1, 0);
    for (long long int i = 0; i < n; i++) {
      fill((f).begin(), (f).end(), 0);
      int mx = 0, k;
      for (long long int j = i; j < n; j++) {
        f[t[j]]++;
        if (f[t[j]] > mx) {
          mx = f[t[j]];
          k = t[j];
        }
        if (f[t[j]] == mx && t[j] < k) {
          mx = f[t[j]];
          k = t[j];
        }
        ans[k]++;
      }
    }
    for (long long int i = 1; i < n + 1; i++) cout << ans[i] << " ";
  }
  return 0;
}
