#include <bits/stdc++.h>
using namespace std;
int b[5555], a[5555];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int z[5555] = {0};
    int maxx = 0, l = 0;
    for (int j = i; j < n; j++) {
      int k = a[j];
      z[k]++;
      if (z[k] > maxx || (a[j] < l && z[k] == maxx)) {
        maxx = z[k];
        l = k;
      }
      b[l]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << b[i] << " ";
}
