#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int u[n + 1];
  int a[n + 1][n + 1];
  int maxx[n + 1];
  int dom[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> u[i];
    for (int j = 1; j <= n; j++) {
      a[i][j] = 0;
    }
    maxx[i] = u[i];
    dom[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      a[u[i]][j]++;
      if (maxx[j] != u[i]) {
        if (a[u[i]][j] > a[maxx[j]][j]) {
          maxx[j] = u[i];
          dom[u[i]]++;
        } else if (a[u[i]][j] == a[maxx[j]][j]) {
          if (u[i] < maxx[j]) {
            maxx[j] = u[i];
            dom[u[i]]++;
          } else {
            dom[maxx[j]]++;
          }
        } else if (a[u[i]][j] < a[maxx[j]][j]) {
          dom[maxx[j]]++;
        }
      } else {
        dom[u[i]]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << dom[i] << " ";
  }
  return 0;
}
