use std::collections::HashSet; fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let m = nm[1]; let mut relations: Vec> = vec![HashSet::new(); n]; for i in 0..n { relations[i].insert(i); } for _ in 0..m { let mut ab = String::new(); std::io::stdin().read_line(&mut ab).ok(); let ab: Vec = ab.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let a = ab[0] - 1; let b = ab[1] - 1; relations[a].insert(b); relations[b].insert(a); } let mut ffriends: Vec> = vec![HashSet::new(); n]; for i in 0..n { &relations[i].iter().for_each(|&f| { if f == i { return; } (&relations[f]).iter().for_each(|&k| { if !(&relations[k]).contains(&i) { ffriends[i].insert(k); } }); }); } let mut result: usize = 0; for i in 0..n { for j in i+1..n { if ffriends[i].contains(&j) { continue; } for k in j+1..n { if ffriends[i].contains(&k) { continue; } if ffriends[j].contains(&k) { continue; } result += 1; } } } println!("{}", result); }