#include <bits/stdc++.h>
using namespace std;
int n;
int balls[5000];
int maxCounts[5000];
vector<int> counts;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> balls[i];
    balls[i]--;
  }
  for (int o = 0; o < n; o++) {
    counts.clear();
    counts.resize(n, 0);
    bool unique = true;
    int maxBall = balls[o];
    counts[balls[o]]++;
    maxCounts[balls[o]]++;
    for (int i = o + 1; i < n; i++) {
      int newCt = counts[balls[i]] + 1;
      if (newCt == counts[maxBall]) {
        maxBall = min(balls[i], maxBall);
      } else if (newCt > counts[maxBall]) {
        maxBall = balls[i];
      }
      counts[balls[i]] = newCt;
      if (unique) {
        maxCounts[maxBall]++;
      }
    }
  }
  cout << maxCounts[0];
  for (int i = 1; i < n; i++) {
    cout << " " << maxCounts[i];
  }
  cout << endl;
  return 0;
}
