#include <bits/stdc++.h>
using namespace std;
int X[5001];
int main() {
std:
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int A[N], C[N + 1];
  memset(C, 0, sizeof(C));
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    C[A[i]] += 1;
    memset(X, 0, sizeof(X));
    X[A[i]]++;
    int large = 1, num = A[i];
    for (int j = i + 1; j < N; j++) {
      X[A[j]]++;
      if (X[A[j]] > large) {
        large = X[A[j]];
        num = A[j];
      } else if (X[A[j]] == large && num > A[j]) {
        large = X[A[j]];
        num = A[j];
      }
      C[num]++;
    }
  }
  for (int i = 1; i <= N; i++) cout << C[i] << " ";
  cout << endl;
}
