#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int arr[5010];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int res[5100] = {0};
  for (int i = 0; i < n; i++) {
    int best_color = arr[i];
    int color[5100] = {0};
    color[arr[i]] = 1;
    res[arr[i]]++;
    for (int j = i + 1; j < n; j++) {
      color[arr[j]]++;
      if (color[arr[j]] > color[best_color] ||
          (color[arr[j]] == color[best_color] && best_color > arr[j])) {
        best_color = arr[j];
      }
      res[best_color]++;
    }
  }
  for (int i = 1; i < n + 1; i++) {
    printf("%d ", res[i]);
  }
  return 0;
}
