#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int answers[n], a[n];
  fill(answers, answers + n, 0);
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
    a[i] -= 1;
  }
  int counts[n], dominant;
  for (int i = (0); i < (n); ++i) {
    dominant = -1;
    fill(counts, counts + n, 0);
    for (int j = (i); j < (n); ++j) {
      counts[a[j]]++;
      if (dominant == -1) {
        dominant = a[j];
      } else if (counts[a[j]] > counts[dominant] ||
                 (counts[a[j]] == counts[dominant] && a[j] < dominant)) {
        dominant = a[j];
      }
      answers[dominant]++;
    }
  }
  for (int i = (0); i < (n); ++i) cout << answers[i] << " ";
  return 0;
}
