Given an array of $$$N$$$ $$$(1 \le N \le 10^5)$$$ elements $$$A_1,A_2,\dots,A_N$$$ $$$(1 \le A_i \le 10^6)$$$. You can replace $$$2$$$ consecutive elements with their sum. Find the minimum number of replacements such that the resulting array is non-decreasing.

As you can easily see, it is the same as split $$$A$$$ into maximum number of segments such that their sums from left to right is non-decreasing.

Thanks.