local n = io.read("*n", "*l") local s = {} for i = 1, n do s[i] = io.read() end local c = 0 local t = {} for i = 1, n do for j = 1, n do if i ~= j then local z = s[i] .. s[j] if not t[z] then t[z] = true c = c + 1 end end end end print(c)