use std::io::Read; fn g(a: u64, b: u64) -> u64 { if b == 0 { a } else { g(b, a % b) } } fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let n: Vec = s.split_whitespace().flat_map(str::parse).collect(); let mut a = 0; for i in 1..n.len() - 2 { for j in i + 1..n.len() - 1 { for k in j + 1..n.len() { if g(n[i], n[j]) == 1 || g(n[j], n[k]) == 1 || g(n[i], n[k]) == 1 { a += 1; } } } } println!("{a}") }