ior = io.read local n = ior("*n") local t = {} local k = {} for i = 1, n do local a = ior("*n") if(t[a] == nil) then table.insert(k, a) t[a] = 1 else t[a] = t[a] + 1 end end if(#k <= 2) then print(0) else local ret = 0 for i = 1, #k - 2 do for j = i + 1, #k - 1 do for l = j + 1, #k do ret = (ret + t[k[i]] * t[k[j]] * t[k[l]]) % 1000000007 end end end print(ret) end