#include <bits/stdc++.h>
using std::abs;
using std::cerr;
using std::cin;
using std::cout;
using std::map;
using std::max;
using std::min;
using std::pair;
using std::set;
using std::string;
using std::swap;
using std::vector;
using ll = long long;
using uint = unsigned int;
using pll = pair<ll, ll>;
template <typename T>
void err(vector<string>::iterator it, T a) {
  cerr << it->substr((*it)[0] == ' ') << " = " << a << '\n';
}
template <typename T, typename... Ts>
void err(vector<string>::iterator it, T a, Ts... as) {
  cerr << it->substr((*it)[0] == ' ') << " = " << a << ", ";
  err(++it, as...);
}
struct init {
  init() {
    cin.tie(0);
    std::iostream::sync_with_stdio(0);
    cout << std::fixed << std::setprecision(10);
    cerr << std::fixed << std::setprecision(10);
    using namespace std::chrono;
    srand(duration_cast<nanoseconds>(
              high_resolution_clock::now().time_since_epoch())
              .count());
  }
  ~init() {
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  }
} init;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int& i : a) cin >> i;
  vector<int> ans(n + 1, 0);
  for (int l = 0; l < n; ++l) {
    vector<int> cnt(n + 1, 0);
    int mx = 1;
    for (int r = l; r < n; ++r) {
      ++cnt[a[r]];
      if (cnt[a[r]] > cnt[mx] || (cnt[a[r]] == cnt[mx] && a[r] < mx)) mx = a[r];
      ++ans[mx];
    }
  }
  for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
  cout << '\n';
  return 0;
}
