#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long res = 0;
  int left = 0, right = 0;
  while (left < N) {
    while (right + 1 < N && A[right] < A[right + 1]) {
      right++;
    }
    int n = right - left + 1;
    res += (n + 1) * n / 2;
    left = ++right;
  }
  cout << res << endl;
  return 0;
}
