#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> t(n);
  for (int i = 0; i < (int)(n); ++i) {
    cin >> t[i];
    t[i]--;
  }
  vector<int> best(n, 0);
  for (int(i) = (int)(0); (i) < (int)(n); ++i) {
    vector<short> counts(n + 1, 0);
    int cur = t[i];
    int cbest = cur;
    best[cbest]++;
    counts[cbest] = 1;
    for (int(j) = (int)(i + 1); (j) < (int)(n); ++j) {
      cur = t[j];
      counts[cur]++;
      if (cur == cbest) {
        best[cur]++;
        continue;
      }
      if (counts[cur] > counts[cbest]) {
        cbest = cur;
        best[cur]++;
        continue;
      }
      if (counts[cur] == counts[cbest]) {
        if (cur < cbest) {
          cbest = cur;
          best[cur]++;
          continue;
        }
      }
      best[cbest]++;
    }
  }
  for (int i = 0; i < (int)(n - 1); ++i) {
    cout << best[i] << " ";
  }
  cout << best[n - 1] << endl;
  return 0;
}
