#505
Bronze II
Daisy Chains
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Every day, as part of her walk around the farm, Bessie the cow visits her favorite pasture, which has NN flowers (all colorful daisies) labeled 1N1\ldots N lined up in a row (1N100)(1\le N \le 100). Flower ii has pip_i petals (1pi1000)(1 \le p_i \le 1000).

As a budding photographer, Bessie decides to take several photos of these flowers. In particular, for every pair of flowers (i,j)(i,j) satisfying 1ijN1\le i\le j\le N, Bessie takes a photo of all flowers from flower ii to flower jj (including ii and jj).

Bessie later looks at these photos and notices that some of these photos have an "average flower" -- a flower that has PP petals, where PP is the exact average number of petals among all flowers in the photo.

How many of Bessie's photos have an average flower?

입력

The first line of input contains NN. The second line contains NN space-separated integers p1pNp_1 \dots p_N.

출력

Please print out the number of photos that have an average flower.

예제 입력 1

4
1 1 2 3

예제 출력 1

6
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Bronze II1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.