A positive integer N and a sequence A=[A1,A2,⋯,AN] of length N are given. Find the number of integer pairs (l,r) that satisfy the following conditions.
1≤l≤r≤N.
The arithmetic mean of the subarray [Al is an integer.
Input
The input is given in the following format.
NA1A2⋯A
Output
Print the answer of the problem on the first line.