#include <bits/stdc++.h>
using namespace std;
using lint = long long;
int a[5555];
int cnt[5555];
int ans[5555];
void solve(istream& cin, ostream& cout) {
  int n;
  cin >> n;
  for (int i = (0); i < int(n); ++i) {
    cin >> a[i];
    --a[i];
  }
  for (int i = (0); i < int(n); ++i) {
    fill(cnt, cnt + n, 0);
    int mx = 0;
    for (int j = (i); j < int(n); ++j) {
      cnt[a[j]]++;
      if (cnt[a[j]] > cnt[mx] || cnt[a[j]] == cnt[mx] && a[j] < mx) {
        mx = a[j];
      }
      ans[mx]++;
    }
  }
  for (int i = (0); i < int(n); ++i) {
    cout << ans[i] << " ";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve(cin, cout);
  return 0;
}
