class Solution {
public long getDescentPeriods(int[] prices) {
int n = prices.length;
int start = 0;
long count = 1;
for (int end = 1; end < n; end++) {
if (prices[end-1] - prices[end] == 1) {
count += end - start + 1;
} else {
start = end;
count++;
}
}
return count;
}
}
/*
2 3
end
[3,2,1,4]
s
*/