Every day, while walking around the farm, Bessie the cow visits her favorite pasture, where flowers (all multicolored daisies) grow in a row, numbered from to . Flower has p_i petals.
As an aspiring photographer, Bessie decided to take some pictures of these flowers. In particular, for every pair of indices with 1 \le i \le j \le n, she takes a photograph of all flowers from to (inclusive).
Later, while looking at these photographs, Bessie notices that some of them contain a median flower — a flower with petals, where is equal to the average number of petals among all flowers in that photograph.
Determine how many photographs contain a median flower.
The first line contains an integer n~(1 \le n \le 100).
The second line contains integers p_1, \ldots, p_n~(1 \le p_i \le 1000).
Print the number of photographs that contain a median flower.
Example 1
Every photograph containing exactly one flower is counted (in the example, there are four such cases). In addition, the segments and correspond to photographs that contain a median flower.