#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int inf = 1e9;
const double eps = 1e-9;
const double pi = 4 * atan(1.0);
const int N = 5555;
int a[N], cnt[N], ans[N];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
    --a[i];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cnt[j] = 0;
    }
    int cur = 0, col = -1;
    for (int j = i; j < n; ++j) {
      ++cnt[a[j]];
      if (cnt[a[j]] > cur) {
        cur = cnt[a[j]];
        col = a[j];
      } else if (cnt[a[j]] == cur) {
        col = min(col, a[j]);
      }
      assert(0 <= col && col < n);
      ++ans[col];
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
  }
  puts("");
  return 0;
}
