Division problem - MarisaOJ: Marisa Online Judge

Division problem

Time limit: 2000 ms
Memory limit: 256 MB
Given a set $A$ consisting of $n$ distinct integers. There are $n \times (n-1) \times (n-2)$ ways to choose three integers $a, b, c$ from the set. Calculate the sum of $\lfloor \frac{a}{b} \rfloor \lfloor \frac{a}{c} \rfloor \lfloor \frac{b}{c} \rfloor$ for all ways to choose three integers $a, b, c$. ### Input - The first line contains an integer $n$. - The second line contains $n$ distinct integers in the set $a$. ### Output - Print the sum of $\lfloor \frac{a}{b} \rfloor \lfloor \frac{a}{c} \rfloor \lfloor \frac{b}{c} \rfloor$ modulo $2^{32}$ for all choices. ### Constraints - $1 \leq n \leq 5000$. - The elements are positive integers not exceeding $5000$. ### Example Input: ``` 4 1 2 3 4 ``` Output: ``` 36 ```