use std::io;
use std::io::Read;

fn main() {
    let mut buf: String = String::new();
    io::stdin().read_to_string(&mut buf).unwrap();

    let mut count: u32 = 0;
    for line in buf.split('\n') {
        if line == "" { continue; }
        println!("{}", line);
        let nums: Vec<u32> = line.split(|a| a == ',' || a == '-')
            .map(|a| a.parse::<u32>().unwrap()).collect();
        // let ab = nums[0] <= nums[2] && nums[1] >= nums[3]; // day 1
        // let ba = nums[0] >= nums[2] && nums[1] <= nums[3];
        let ab = nums[1] >= nums[2] && nums[0] <= nums[2]; // day 2
        let ba = nums[3] >= nums[0] && nums[2] <= nums[0];
        if ab || ba { count += 1; }
    }

    println!("done? {}", count);
}