#include <bits/stdc++.h>
using namespace std;
long long n, m, t, x, y, c, d, a[5001], res[5001], cnt[5001];
bool f;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  for (long long i = 0; i < n; ++i) {
    for (long long j = i; j < n; ++j) {
      ++cnt[a[j]];
      if (x < cnt[a[j]]) {
        x = cnt[a[j]];
        y = a[j];
      } else if (x == cnt[a[j]])
        y = min(y, a[j]);
      ++res[y];
    }
    memset(cnt, 0, sizeof(cnt));
    x = 0;
    y = 0;
  }
  for (long long i = 1; i <= n; ++i) cout << res[i] << " ";
  cout << endl;
  return 0;
}
