#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> color(n);
  map<int, int> sum;
  for (int i = 0; i < n; i++) {
    sum[i + 1] = 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> color[i];
  }
  for (int i = 0; i < n; i++) {
    int maxInd = 0;
    vector<int> count(n, 0);
    for (int j = i; j < n; j++) {
      int ind = color[j] - 1;
      count[color[j] - 1]++;
      if (count[ind] > count[maxInd])
        maxInd = ind;
      else if (count[ind] == count[maxInd])
        maxInd = min(ind, maxInd);
      sum[maxInd + 1] += 1;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << sum[i + 1] << " ";
  }
  cout << endl;
}
