#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, max = 0, s = 0;
  cin >> n;
  vector<int> v(n + 1);
  vector<int> z(n + 1);
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int i = 1; i <= n; i++) {
    vector<int> k(n + 1, 0);
    max = v[i];
    k[v[i]] = 1;
    z[max]++;
    for (int j = i + 1; j <= n; j++) {
      k[v[j]]++;
      if (k[v[j]] > k[max]) {
        max = v[j];
      } else if (k[v[j]] == k[max] && max > v[j])
        max = v[j];
      z[max]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << z[i] << " ";
  return 0;
}
