pub fn count_instances<T: Ord>(x: &[T], d: &T) -> i32