StatementStatement languageEnglishexpand_more한국어EnglishA positive integer NNN and a sequence A=[A1,A2,⋯ ,AN]A = [A_1, A_2, \cdots, A_{N}]A=[A1,A2,⋯,AN] of length NNN are given. Find the number of integer pairs (l,r)(l, r)(l,r) that satisfy the following conditions. 1≤l≤r≤N1 \leq l \leq r \leq N1≤l≤r≤N. max(Al,Al+1,⋯ ,Ar)=Al+Ar\max(A_l, A_{l + 1}, \cdots, A_r) = A_l + A_rmax(A. InputThe input is given in the following format.NNN A1 A2 ⋯ ANA_1 \ A_2 \ \cdots \ A_{N}A1 A2 ⋯ AOutputPrint the answer on the first line.Constraints 1≤N≤200 0001 \leq N \leq 200 \ 0001≤N≤200 000. 1≤Ai≤10181 \leq A_i \leq 10^{18}1≤Ai (). Subtasks#ScoreConstraints111N≤200N \leq 200N≤200.227N≤2 000N \leq 2 \ 000N≤2 000.362No additional constraints.SamplesSample 1InputCopy5 1 3 2 4 1OutputCopy2Sample 2InputCopy5 1 10 9 10 1OutputCopy2Show tags