#include <bits/stdc++.h>
using namespace std;
ifstream f("date.in");
int v[5001], viz[5001], maxim[5001];
void reset(int n) {
  int i;
  for (i = 1; i <= n; ++i) viz[i] = 0;
}
int main() {
  int i, n, j, aux;
  std::ios_base::sync_with_stdio();
  cin >> n;
  for (i = 1; i <= n; ++i) cin >> v[i];
  for (i = 1; i <= n; ++i) {
    aux = v[i];
    for (j = i; j <= n; ++j) {
      ++viz[v[j]];
      if (viz[v[j]] > viz[aux]) {
        aux = v[j];
        ++maxim[v[j]];
      } else {
        if (viz[v[j]] == viz[aux]) {
          if (v[j] < aux) {
            aux = v[j];
            ++maxim[v[j]];
          } else
            ++maxim[aux];
        } else
          ++maxim[aux];
      }
    }
    reset(n);
  }
  for (i = 1; i <= n; ++i) cout << maxim[i] << " ";
}
