#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int64_t n, c = 1, mn, x, m = 1, z;
  int64_t ans = 1;
  cin >> n;
  vector<int64_t> v(n);
  for (auto &i : v) cin >> i;
  z = v[0];
  for (int64_t i = 1; i < n; i++) {
    if (z == v[i])
      c++;
    else
      z = v[i], c = 1;
    ans += c;
  }
  cout << ans << endl;
  return 0;
}
