#include <bits/stdc++.h>
using namespace std;
struct data {
  int color, sum;
};
class comparison {
 public:
  bool operator()(pair<int, int> a, pair<int, int> b) {
    return (a.first > b.first || (a.first == b.first && (a.second < b.second)));
  }
};
class cmp {
 public:
  bool operator()(data a, data b) {
    return (a.sum < b.sum || (a.sum == b.sum && a.color > b.color));
  }
};
int n, a[int(5e3) + 100], res[int(5e3) + 100], f[int(5e3) + 100];
void sol() {
  for (int i = 0; i < n; i++) {
    priority_queue<data, vector<data>, cmp> q;
    while (q.empty() == 0) {
      q.pop();
    }
    for (int j = 0; j < n; j++) {
      f[j] = 0;
    }
    for (int j = i; j < n; j++) {
      f[a[j]]++;
      data tmp;
      tmp.sum = f[a[j]];
      tmp.color = a[j];
      q.push(tmp);
      tmp = q.top();
      while (tmp.sum != f[tmp.color]) {
        q.pop();
        tmp = q.top();
      }
      res[tmp.color]++;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  sol();
  for (int i = 0; i < n; i++) {
    cout << res[i] << " ";
  }
}
