func main() var n: int :: cui@inputInt() var a: []int :: #[n + 1]int for i(0, n - 1) do a[i] :: cui@inputInt() end for do a[n] :: 0 var ans: int :: 0 var cnt: int :: 0 for i(1, n) if(a[i] = a[i - 1] + 1) do cnt :+ 1 else if(cnt <> 0) do ans :+ cnt * (cnt + 1) / 2 do cnt :: 0 end if end if end for do cui@print("\{ans}\n") end func