func main() var n: int :: cui@inputInt() var a: []int :: #[n]int for i(0, n - 1) do a[i] :: cui@inputInt() end for var mp: dict :: #dict for i(0, n - 1) do mp.add(a[i], mp.get(a[i], &) + 1) end for var ans: int :: 0 var keys: []int block var keyList: List :: #List class List() +var li: list *func ctor() do me.li :: #list end func end class do mp.forEach(callback, keyList $ kuin@Class) func callback(key: int, value: int, data: kuin@Class): bool do(data $ List).li.add(key) ret true end func do keys :: keyList.li.toArray() end block for i(0, ^keys - 1) for j(i + 1, ^keys - 1) for k(j + 1, ^keys - 1) do ans :+ mp.get(keys[i], &) * mp.get(keys[j], &) * mp.get(keys[k], &) end for end for end for do ans :% 10 ^ 9 + 7 do cui@print("\{ans}\n") end func