#include <bits/stdc++.h>
using namespace std;
template <typename T>
void show(vector<T> a, int p = 0) {
  for (int i = 0; i < a.size(); i++) {
    if (p == 0) cout << a[i] << endl;
    if (p == 1 || p == 2) cout << a[i] << ' ';
  }
  if (p == 2) cout << endl;
}
int main() {
  int c = 0, x;
  int n = 0;
  cin >> n;
  vector<int> vec(n);
  vector<int> res(n);
  vector<vector<int> > rrr(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  for (int i = 0; i < n; i++) {
    vector<int> tmp(n);
    int MA = 0, ind = 0;
    for (int j = i; j < n; j++) {
      tmp[vec[j] - 1]++;
      if (tmp[vec[j] - 1] > MA) {
        MA++;
        ind = vec[j] - 1;
        res[ind]++;
      } else if (tmp[vec[j] - 1] == MA) {
        ind = min(ind, vec[j] - 1);
        res[ind]++;
      } else {
        res[ind]++;
      }
    }
  }
  show(res, 1);
  return 0;
}
