use std::{ collections::VecDeque, io::{stdin, Read}, }; fn main() { let mut input = String::new(); stdin().lock().read_to_string(&mut input).unwrap(); let mut ints = input .split_ascii_whitespace() .map(|i| i.parse::().unwrap()); let mut get = || ints.next().unwrap(); for case in 0..get() { let n = get(); let mut ds: VecDeque<_> = (0..n).map(|_| get()).collect(); let mut ans = 0; let mut max = 0; while !ds.is_empty() { let f = ds.front().unwrap(); let b = ds.back().unwrap(); let d = if f < b { ds.pop_front().unwrap() } else { ds.pop_back().unwrap() }; if d >= max { ans += 1; max = d; } } println!("Case #{}: {}", case + 1, ans); } }