#include <bits/stdc++.h>
using namespace std;
const int Max = 5e3 + 10;
const int Mod = 1e9 + 7;
const long long int Inf = 1LL << 62;
int ar[Max];
int cnt[Max];
int ans[Max];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, mx = 0, idx = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  for (int i = 1; i <= n; i++) {
    memset(cnt, 0, sizeof cnt);
    mx = 0, idx = 0;
    for (int j = i; j <= n; j++) {
      cnt[ar[j]]++;
      if (cnt[ar[j]] > mx) {
        mx = cnt[ar[j]];
        idx = ar[j];
      } else if (cnt[ar[j]] == mx && ar[j] < idx) {
        mx = cnt[ar[j]];
        idx = ar[j];
      }
      ans[idx]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
