#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> t;
  copy_n(istream_iterator<int>(cin), n, back_inserter(t));
  vector<bool> ends_with_dom(n * n, false);
  for (int i = 0; i < n; ++i) {
    vector<int> cnts(n + 1, 0);
    cnts[t[i]] = 1;
    ends_with_dom[n * i + i] = true;
    int max_cl = t[i];
    for (int j = i - 1; j >= 0; --j) {
      ++cnts[t[j]];
      if (cnts[t[j]] > cnts[max_cl] ||
          t[j] < max_cl && cnts[t[j]] == cnts[max_cl])
        max_cl = t[j];
      ends_with_dom[n * j + i] = max_cl == t[i];
    }
  }
  vector<int> res(n + 1, 0);
  int dom_cl;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      if (ends_with_dom[n * i + j]) dom_cl = t[j];
      ++res[dom_cl];
    }
  }
  copy(res.begin() + 1, res.end(), ostream_iterator<int>(cout, " "));
}
