#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  int m[n + 1], m1[n + 1];
  for (int i = 0; i < n; i++) {
    m[i + 1] = 0;
    scanf("%d", &a[i]);
  }
  int best;
  for (int i = 0; i < n; i++) {
    for (int i = 0; i < n; i++) m1[i + 1] = 0;
    best = a[i];
    m[best]++;
    m1[best]++;
    for (int j = i + 1; j < n; j++) {
      m1[a[j]]++;
      if ((m1[a[j]] > m1[best]) || (m1[a[j]] == m1[best] && a[j] < best))
        best = a[j];
      m[best]++;
    }
  }
  for (int i = 1; i < n + 1; i++) printf("%d ", m[i]);
  return 0;
}
