#include <bits/stdc++.h>
using namespace std;
const int MX = 5000 + 9;
int t[MX];
int n;
int counts[MX] = {0};
int ans[MX];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
    t[i]--;
  }
  for (int start = 0; start < n; start++) {
    memset(counts, 0, n * sizeof(int));
    int best = 0;
    for (int finish = start; finish < n; finish++) {
      int who = t[finish];
      counts[who]++;
      if (counts[who] > counts[best] ||
          (counts[who] == counts[best] && who < best))
        best = who;
      ans[best]++;
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  return 0;
}
