#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000009;
const int maxn = 5005;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), ans(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) {
    vector<int> b(n + 1);
    int prev = a[i];
    for (int j = i; j < n; ++j) {
      b[a[j]]++;
      if (b[a[j]] > b[prev]) {
        ans[a[j] - 1]++;
        prev = a[j];
      } else if (b[a[j]] == b[prev] && a[j] < prev) {
        ans[a[j] - 1]++;
        prev = a[j];
      } else {
        ans[prev - 1]++;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
