#include <bits/stdc++.h>
using namespace std;
long long n, temp, tresh = 1, counter = 0;
vector<int> arr, dp(5005, 0);
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  ;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    arr.push_back(temp);
  }
  for (int i = 0; i < n; i++) {
    vector<int> cnt(n + 5, 0);
    int best = 0, bestcol = 6000;
    for (int j = i; j < n; j++) {
      cnt[arr[j]]++;
      if (cnt[arr[j]] > best) {
        best = cnt[arr[j]];
        bestcol = arr[j];
      } else if (cnt[arr[j]] == best && bestcol > arr[j]) {
        bestcol = arr[j];
      }
      dp[bestcol]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << dp[i] << " ";
  }
}
