#include <bits/stdc++.h>
using namespace std;
int ara[5010], ara2[5010], ara1[5010];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 1; i <= n; i++) {
      cin >> ara[i];
    }
    int mx = 0, value = n + 10;
    for (int i = 1; i <= n; i++) {
      mx = 0, value = n + 10;
      memset(ara1, 0, sizeof(ara1));
      for (int j = i; j <= n; j++) {
        int x = ara[j];
        ara1[x]++;
        if (ara1[x] > mx) {
          value = x;
          mx = ara1[x];
        } else if (ara1[x] == mx) {
          value = min(value, x);
        }
        ara2[value]++;
      }
    }
    for (int i = 1; i <= n; i++) {
      if (i == n)
        cout << ara2[i] << endl;
      else
        cout << ara2[i] << ' ';
    }
  }
}
