#include <bits/stdc++.h>
using namespace std;
int a[5100], deg[5100];
pair<int, int> ans;
int Ans[5100];
short int gas[5100][5100];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      gas[i][j] = gas[i][j - 1];
      if (a[j] == i) gas[i][j]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    ans = pair<int, int>(1, -a[i]);
    Ans[-ans.second]++;
    for (int j = i + 1; j <= n; j++) {
      int x = a[j];
      int num = gas[x][j] - gas[x][i - 1];
      pair<int, int> b = pair<int, int>(num, -x);
      if (ans < b) ans = b;
      Ans[-ans.second]++;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", Ans[i]);
  return 0;
}
