A sequence consisting of nonzero integers is called noise-cancelling if there exists a positive integer such that its length is and
holds for every (), where denotes the -th element of . In other words, the second half of a noise-cancelling sequence is the elementwise negation of its first half, so the corresponding elements cancel each other out. In particular, no sequence of odd length is noise-cancelling.
For example, is noise-cancelling.
You are given a sequence of nonzero integers . Find the number of pairs of integers () such that the contiguous subsequence is noise-cancelling.
输入格式
The input consists of a single test case of the following format.
N
a_1 a_2 ... a_N
The first line contains an integer (), representing the length of the sequence.
The second line contains nonzero integers (), representing the elements of the sequence.
输出格式
Print a single integer representing the number of pairs such that is noise-cancelling.