#include using namespace std; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() typedef pair P; signed main(){ int n,m;cin>>n>>m; vector

v(m); REP(i,m){ int d,h,mi;char c; cin>>d>>h>>c>>mi; v[i].second=(d*24+h)*60+mi; cin>>d>>h>>c>>mi; v[i].first=(d*24+h)*60+mi; } sort(ALL(v)); multiset s; REP(i,n)s.insert(0); int ans=0; REP(i,m){ int en=v[i].first,be=v[i].second; if(*s.begin()>=be)continue; s.erase(--s.lower_bound(be)); s.insert(en); ans++; } cout<