#include <bits/stdc++.h>
using namespace std;
const long long nax = 1e5 + 5;
vector<long long> adj[nax];
const long long mod = 1e9 + 7;
const long long inf = 1e18 + 7;
long long m_ans[nax];
long long cnt[nax];
long long a[nax];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long majority = 0;
  for (long long i = 0; i < n; i++) {
    memset(cnt, 0, sizeof(cnt));
    majority = a[i];
    cnt[majority] = 1;
    m_ans[majority]++;
    ;
    for (long long j = i + 1; j < n; j++) {
      cnt[a[j]]++;
      if (cnt[majority] == cnt[a[j]]) {
        if (majority < a[j]) {
          m_ans[majority]++;
          continue;
        } else {
          m_ans[a[j]]++;
          majority = a[j];
          continue;
        }
      } else if (cnt[a[j]] > cnt[majority]) {
        majority = a[j];
        m_ans[majority]++;
        continue;
      } else {
        m_ans[majority]++;
        continue;
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    cout << m_ans[i] << "\n";
  }
  return 0;
}
