#include <bits/stdc++.h>
using namespace std;
int a[5005], b[5005], ans[5005];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) {
      int dominant = 0;
      int color = 0;
      memset(b, 0, sizeof(b));
      for (int j = i; j <= n; j++) {
        b[a[j]]++;
        if (b[a[j]] > dominant) {
          dominant = b[a[j]];
          color = a[j];
        }
        if (b[a[j]] == dominant && a[j] < color) color = a[j];
        ans[color]++;
      }
    }
    for (int i = 1; i <= n; i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
    memset(ans, 0, sizeof(ans));
  }
}
