#include <bits/stdc++.h>
using namespace std;
int f[5005][5005];
int m[5005];
int ans[5005];
int n, x;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    for (int j = 0; j <= i; ++j) {
      f[j][x]++;
      if (f[j][x] > f[j][m[j]]) {
        m[j] = x;
      } else if (f[j][x] == f[j][m[j]] && x < m[j]) {
        m[j] = x;
      }
      ans[m[j]]++;
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << " ";
  }
  return 0;
}
