#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
const int INF = 1000000007;
const int MOD = 1000000007;
const long long LLNF = (long long)10e17 + 7;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& i : v) is >> i;
  return is;
}
template <typename T>
ostream& operator<<(ostream& is, vector<T>& v) {
  for (auto& i : v) is << i << " ";
  return is;
}
void ff() { fflush(stdout); }
void IO(string name = "") {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if ((int)(name).size()) {
    freopen((name + ".in").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
  }
}
struct pred {
  bool operator()(const std::pair<int, int>& l, const std::pair<int, int>& r) {
    return l.second < r.second;
  }
};
int ans[5005];
int main() {
  IO();
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = (0); i < (n); ++i) {
    int x;
    cin >> x;
    a[i] = x;
  }
  for (int i = (0); i < (n); ++i) {
    vector<int> cur(n + 1);
    int best = 0;
    for (int j = (i); j < (n); ++j) {
      ++cur[a[j]];
      if (cur[a[j]] > cur[best] || cur[a[j]] == cur[best] && a[j] < best)
        best = a[j];
      ++ans[best];
    }
  }
  for (int i = (1); i < (n + 1); ++i) cout << ans[i] << " ";
  cout << "\n";
  return 0;
}
