Given an array A of length containing only 1 and -1. The number of 1 is not more than . Please count how many pairs of (l, r) satisfy and .
输入描述:
The first line of input contains an integers N indicating how many segments of A is 1. Following N lines each contains two space-separated integers indicating that is 1 for
for
输出描述:
Output one line containing an integer representing the answer.