#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {-1, 1, 0, 0, -1, -1, 1, 1};
const int mod = 1000000007;
const double pi = acos(-1);
const long long OO = INT_MAX;
double distance(double a, double b, double x, double y) {
  return sqrt((x - a) * (x - a) + ((y - b) * (y - b)));
}
int c[5000 + 1];
int Ans[5000 + 1];
int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int N;
  scanf("%d", &N);
  int A[N];
  for (int i = 0; i < N; i++) scanf("%d", &A[i]);
  for (int i = 0; i < N; i++) {
    memset(c, 0, sizeof(c));
    int mx = 0, dominant;
    for (int j = i; j < N; j++) {
      c[A[j]]++;
      if (c[A[j]] > mx || (c[A[j]] == mx && dominant > A[j])) {
        mx = c[A[j]];
        dominant = A[j];
      }
      Ans[dominant]++;
    }
  }
  for (int i = 0; i < N; i++) cout << Ans[i + 1] << ' ';
}
