#include <bits/stdc++.h>
using namespace std;
const long long OO = 1e6;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n), ans(n, 0);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i]--;
  }
  for (int i = 0; i < n; i++) {
    vector<int> c(n, 0);
    int v = a[i];
    c[a[i]]++;
    ans[v]++;
    for (int j = i + 1; j < n; j++) {
      c[a[j]]++;
      if (c[a[j]] > c[v] || ((c[a[j]] == c[v]) && a[j] < v)) v = a[j];
      ans[v]++;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  printf("\n");
}
