#include <bits/stdc++.h>
using namespace std;
const int N = 5000 + 5;
int col[N], a[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) {
    int pos = 0;
    for (int j = 0; j < n; ++j) {
      col[j] = 0;
    }
    for (int j = i; j < n; ++j) {
      col[a[j]]++;
      if (col[a[j]] > col[pos] || (col[a[j]] == col[pos] && a[j] < pos)) {
        pos = a[j];
      }
      ans[pos]++;
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
  }
  cout << endl;
  return 0;
}
