#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int MOD = 1000000007;
const long long INFLL = 1e18;
const double PI = 2 * acos(0.0);
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  int res[n + 1];
  memset(res, 0, sizeof(res));
  for (int i = 0; i < n; ++i) {
    int cnt[n + 1];
    memset(cnt, 0, sizeof(cnt));
    int curr = 0, elem = INF;
    for (int j = i; j < n; ++j) {
      cnt[a[j]]++;
      if (cnt[a[j]] > curr) curr = cnt[a[j]], elem = a[j];
      if (cnt[a[j]] == curr) elem = min(elem, a[j]);
      ++res[elem];
    }
  }
  for (int i = 1; i <= n; ++i) printf("%d ", res[i]);
  return printf("\n"), 0;
}
