#include <bits/stdc++.h>
using namespace std;
const int maxn = 5050;
int n;
int res[maxn];
int a[maxn];
pair<int, int> best;
int cnt[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); ++i) scanf("%d", &a[i]);
  for (int i = 0; i < (int)(n); ++i) {
    for (int j = 0; j < (int)(n + 1); ++j) cnt[j] = 0;
    best = {-1, -1};
    for (int j = i; j < n; ++j) {
      ++cnt[a[j]];
      best = max(best, pair<int, int>(cnt[a[j]], -a[j]));
      ++res[-best.second];
    }
  }
  for (int i = 0; i < (int)(n); ++i) cout << res[i + 1] << " ";
  cout << endl;
  return 0;
}
