#include <bits/stdc++.h>
using namespace std;
int MIN(int a, int b) { return a < b ? a : b; }
int n;
struct Node {
  int num[5005];
  int max;
  int ans;
} No[5005];
void init() {
  int i, j;
  for (i = 0; i < n; ++i) {
    for (j = 0; j <= n; ++j) {
      No[i].num[j] = 0;
    }
  }
}
int main() {
  int i, j;
  while (~scanf("%d", &n)) {
    init();
    int num[5005];
    int ans[5005] = {0};
    for (i = 0; i < n; ++i) {
      scanf("%d", &num[i]);
      ans[num[i]]++;
    }
    int len = 3;
    for (i = 0, j = 1; j < n; ++i, ++j) {
      No[i].num[num[i]]++;
      No[i].num[num[j]]++;
      if (num[i] == num[j])
        No[i].max = 2;
      else
        No[i].max = 1;
      No[i].ans = MIN(num[i], num[j]);
      ans[No[i].ans]++;
    }
    while (len <= n) {
      for (i = 0, j = len - 1; j < n; ++i, ++j) {
        if (++No[i].num[num[j]] > No[i].max) {
          No[i].max = No[i].num[num[j]];
          No[i].ans = num[j];
          ans[No[i].ans]++;
        } else if (No[i].num[num[j]] == No[i].max) {
          if (num[j] < No[i].ans) {
            No[i].ans = num[j];
            ans[No[i].ans]++;
          } else
            ans[No[i].ans]++;
        } else {
          ans[No[i].ans]++;
        }
      }
      len++;
    }
    for (i = 1; i < n; ++i) printf("%d ", ans[i]);
    printf("%d\n", ans[i]);
  }
  return 0;
}
