use proconio::{input, marker::Chars}; use std::collections::HashSet; fn main() { input! { n: usize, } let mut s: Vec = Vec::new(); for _ in 0..n { input! { a: Chars, }; s.push(a.iter().collect()); } let mut ans: Vec = Vec::new(); for i in 0..n { for j in 0..n { if i == j { continue } let c = format!("{}{}", s[i], s[j]); ans.push(c); } } let t: HashSet<_> = ans.iter().collect(); println!("{}", t.len()); }