Divisible by 3
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
For an array of integers, let's define its weight as the sum of pairwise products of its elements, namely as the sum of over .
You are given an array of integers , and are asked to find the number of pairs of integers with , for which the weight of the subarray is divisible by .
Input
The first line contains a single integer — the length of the array.
The second line contains integers — the elements of the array.
Output
Output a single integer — the number of pairs of integers with , for which the weight of the corresponding subarray is divisible by .
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 17
Acceptance rate 47%