#include <bits/stdc++.h>
using namespace std;
int n;
int arr[5000], ans[5000];
void solve() {
  for (int i = 0; i < n; ++i) {
    int cnt[5000], mx = 0;
    memset(cnt, 0, sizeof(cnt));
    for (int j = i; j < n; ++j) {
      cnt[arr[j] - 1]++;
      if (cnt[arr[j] - 1] > cnt[mx]) {
        mx = arr[j] - 1;
      } else if (cnt[arr[j] - 1] == cnt[mx] && arr[j] - 1 < mx) {
        mx = arr[j] - 1;
      }
      ans[mx]++;
    }
  }
}
int main(int argc, char *argv[]) {
  scanf("%d", &n);
  memset(ans, 0, sizeof(ans));
  for (int i = 0; i < n; ++i) {
    scanf("%d", &arr[i]);
  }
  solve();
  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
  }
  return 0;
}
