#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
const int INF = 1000000000;
const int MAX = 7000;
const int MAX2 = 7000;
const int BASE = 1000000000;
int n;
int A[MAX];
int C[MAX];
int R[MAX];
int main() {
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    int x;
    cin >> x;
    --x;
    A[i] = x;
  }
  for (int i = (0); i < (n); ++i) {
    int cnt = -1, id = -1;
    for (int j = (0); j < (n); ++j) C[j] = 0;
    for (int j = (i); j < (n); ++j) {
      ++C[A[j]];
      if (C[A[j]] > cnt) {
        cnt = C[A[j]];
        id = A[j];
      } else if (C[A[j]] == cnt && A[j] < id) {
        id = A[j];
      }
      ++R[id];
    }
  }
  for (int i = (0); i < (n); ++i) cout << R[i] << ' ';
  return 0;
}
