use std::{collections::HashSet, io::Read}; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut h = HashSet::new(); let s: Vec<_> = s.split_whitespace().skip(1).collect(); for i in 0..s.len() { for j in i + 1..s.len() { h.insert(s[i].to_owned() + s[j]); h.insert(s[j].to_owned() + s[i]); } } println!("{}", h.len()) }