#include <bits/stdc++.h>
using namespace std;
int c[5001], intv[5005], temp[5005 * 5005];
int main() {
  int n, t = 0;
  scanf("%d", &n);
  register int i, j, cur = 0, t1;
  for (i = 0; i < n; i++) scanf("%d", &c[i]);
  for (i = 0; i < n; i++) {
    temp[t + c[i]]++;
    intv[c[i]]++;
    cur = c[i];
    for (j = (i + 1); j < n; j++) {
      t1 = c[j];
      temp[t + t1]++;
      if (temp[t + cur] > temp[t + t1] ||
          (temp[t + cur] == temp[t + t1] && cur < t1)) {
        intv[cur]++;
      } else {
        intv[t1]++;
        cur = t1;
      }
    }
    t += n;
  }
  for (i = 1; i < n + 1; i++) printf("%d ", intv[i]);
  return 0;
}
