#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int colors[5001], ans[5001] = {0};
  for (int i(0); i < n; ++i) cin >> colors[i];
  for (int i(0); i < n; ++i) {
    int nc[5001] = {0}, dom(0);
    for (int j(i); j < n; ++j) {
      nc[colors[j]]++;
      if (nc[colors[j]] > nc[dom] ||
          (nc[colors[j]] == nc[dom] && colors[j] < dom))
        dom = colors[j];
      ans[dom]++;
    }
  }
  for (int i(1); i <= n; ++i) cout << ans[i] << ' ';
}
