#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int t[N], c[N], ans[N];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      c[j] = 0;
    }
    int best = 0;
    for (int j = i; j <= n; j++) {
      int color = t[j];
      c[color]++;
      if (c[color] > c[best] || (c[color] == c[best] && color < best))
        best = color;
      ans[best]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
}
