#!/usr/bin/perl -w

use v5.36;
use strict;
use experimental 'multidimensional';

my $count;
while (<>) {
	my @r = /\d+/g;
	$count++ if $r[0] <= $r[2] && $r[1] >= $r[3]
		|| $r[0] >= $r[2] && $r[1] <= $r[3]
		|| $r[0] <= $r[2] && $r[1] >= $r[2]
		|| $r[0] <= $r[3] && $r[1] >= $r[3];
}
say $count;
	
