local n = io.read("*n") local t = {} for i = 1, n do local a = io.read("*n") if t[a] then t[a] = t[a] + 1 else t[a] = 1 end end local lim = 2432902008176640000LL local frac = {} frac[1] = 1LL for i = 2, n do frac[i] = frac[i - 1] * i end local tot = frac[n] for k, v in pairs(t) do tot = tot / frac[v] end tot = tostring(tot):gsub("LL", "") print(tot)