#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> counts(n, 0);
  vector<int> arrayin(n);
  for (int i = 0; i < n; i++) {
    cin >> arrayin[i];
  }
  vector<int> tempcounts(n, 0);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      tempcounts[j] = 0;
    }
    int tempmax = -1;
    for (int j = i; j < n; j++) {
      tempcounts[arrayin[j] - 1]++;
      if (tempmax == -1) tempmax = arrayin[j] - 1;
      if (tempcounts[arrayin[j] - 1] >= tempcounts[tempmax]) {
        if (tempcounts[arrayin[j] - 1] > tempcounts[tempmax])
          tempmax = arrayin[j] - 1;
        else if (arrayin[j] - 1 < tempmax)
          tempmax = arrayin[j] - 1;
      }
      counts[tempmax]++;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << counts[i] << " ";
  }
  cout << endl;
  return 0;
}
