#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int dominant[n];
  int balls[n];
  for (int i = 0; i < n; i++) {
    cin >> balls[i];
    balls[i]--;
    dominant[i] = 0;
  }
  for (int j = 0; j < n; j++) {
    int curr[n];
    for (int i = 0; i < n; i++) {
      curr[i] = 0;
    }
    curr[balls[j]]++;
    int lasth = balls[j];
    dominant[balls[j]]++;
    for (int i = j + 1; i < n; i++) {
      curr[balls[i]]++;
      if (curr[balls[i]] == curr[lasth]) {
        if (balls[i] < lasth) {
          dominant[balls[i]]++;
          lasth = balls[i];
        } else {
          dominant[lasth]++;
        }
      } else if (curr[balls[i]] > curr[lasth]) {
        dominant[balls[i]]++;
        lasth = balls[i];
      } else {
        dominant[lasth]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << dominant[i] << " ";
  }
  return 0;
}
