void main(){ import std.stdio, std.string, std.conv, std.algorithm; import std.typecons, std.container; int n, m; rd(n, m); auto seq=new Tuple!(int, int)[](m); foreach(i; 0..m){ int d1, d2; string t1, t2; rd(d1, t1, d2, t2); auto st=d1*24*60+to!(int)(t1[0..2])*60+to!(int)(t1[3..$]); auto ed=d2*24*60+to!(int)(t2[0..2])*60+to!(int)(t2[3..$]); seq[i]=Tuple!(int, int)(st, ed); } sort!"a[1]=0) data[j]=e[1], sum++; } writeln(sum); } void rd(T...)(ref T x){ import std.stdio, std.string, std.conv; auto l=readln.split; assert(l.length==x.length); foreach(i, ref e; x){ e=l[i].to!(typeof(e)); } }