#include <bits/stdc++.h>
using namespace std;
int n, t[5050], c[5050], f[5050];
int main() {
  scanf("%d", &n);
  for (int j = 1; j <= n; ++j) {
    scanf("%d", &t[j]);
    memset(c, 0, sizeof c);
    int u = -1, v = 0;
    for (int i = j; i >= 1; --i) {
      ++c[t[i]];
      if (u == -1 || v < c[t[i]] || (v == c[t[i]] && u > t[i])) {
        u = t[i];
        v = c[t[i]];
      }
      ++f[u];
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << f[i] << " ";
  }
  return 0;
}
