use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let t: usize = itr.next().unwrap().parse().unwrap(); let mut out = Vec::new(); for _ in 0..t { let n: usize = itr.next().unwrap().parse().unwrap(); let mut a: Vec = (0..n) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); a.sort(); let mut ans = 0; let mut used = vec![false; n]; for i in 0..n { for j in i + 1..n { for k in j + 1..n { if a[i] != a[j] && a[j] != a[k] && !used[i] && !used[j] && !used[k] { ans += 1; used[i] = true; used[j] = true; used[k] = true; } } } } writeln!(out, "{}", ans).ok(); } stdout().write_all(&out).unwrap(); }