#include <bits/stdc++.h>
using namespace std;
int balls[5001];
int color[5001];
int dominant[5001];
int maxi[5001][5001];
int main(void) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> balls[i];
  }
  int maxval;
  int int_s, int_e;
  for (int i = 0; i < n; i++) {
    maxval = 0;
    for (int j = 0; j < n; j++) color[balls[j]] = 0;
    for (int j = i; j < n; j++) {
      color[balls[j]]++;
      if (color[balls[j]] > maxval) {
        maxval = color[balls[j]];
        int_s = i;
        int_e = j;
        maxi[i][j] = balls[j];
      } else if (color[balls[j]] == maxval && balls[j] < maxi[int_s][int_e]) {
        int_s = i;
        int_e = j;
        maxi[i][j] = balls[j];
      } else
        maxi[i][j] = maxi[int_s][int_e];
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      dominant[maxi[i][j]]++;
    }
  for (int i = 1; i <= n; i++) cout << dominant[i] << " ";
  return 0;
}
