#include <bits/stdc++.h>
using namespace std;
int c[5555], ans[5555];
int main() {
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    memset(c, 0, sizeof(c));
    int bc = 0, bt = -1;
    for (int j = i; j <= n; j++) {
      int s = ++c[a[j]];
      if (s > bc || (s == bc && a[j] < bt)) bc = s, bt = a[j];
      ++ans[bt];
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
}
