#include <bits/stdc++.h>
using namespace std;
int nos[5050], su[5050], fi[5050], ans, no;
int main() {
  int n, temp;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &nos[i]);
  for (int i = 0; i < n; i++) {
    memset(su, 0, sizeof su);
    ans = 0;
    for (int j = i; j < n; ++j) {
      su[nos[j]]++;
      if (su[nos[j]] > ans) {
        ans = su[nos[j]];
        no = nos[j];
      } else if (su[nos[j]] == ans && nos[j] < no)
        no = nos[j];
      fi[no]++;
    }
  }
  for (int i = 0; i < n; i++) cout << fi[i + 1] << ' ';
  cout << endl;
}
