DOBRI
시간 제한: 1000ms메모리 제한: 128MB출처: COCI 2012-2013BOJ 5624
문제
You are given a sequence A consisting of N integers (not to be confused with the sequence from the previous task). We will call the ith sequence element good if it equals the sum of some three elements in positions strictly smaller than i (an element can be used more than once in the sum).
How many good elements does the sequence contain?
입력
The first line of input contains the positive integer N (1 ≤ N ≤ 5000), the length of the sequence A.
The second line of input contains N space-separated integers representing the sequence A (-100 000 ≤ Ai ≤ 100 000).
출력
The first and only line of output must contain the number of good elements in the sequence.
예제
예제 1
입력
2 1 3
출력
1
예제 2
입력
6 1 2 3 5 7 10
출력
4
예제 3
입력
3 -1 2 0
출력
1
코드를 제출하려면 로그인하세요.