import sequtils, strutils,algorithm var N = stdin.readLine.parseInt r,R,cnt : int A = newSeq[array[0..1, int]](0) for i in 1..N: var in1 = stdin.readLine.split.map(parseInt) (r, R) = (in1[0], in1[1]) A.add([r, 1]) A.add([R, -1]) A.add([1000000005, 0]) proc cmp1(x, y : array[2, int]): int = system.cmp(x[0], y[0]) var res = 0 sort(A, cmp1) for i, a in A: if i + 1 == A.len: break cnt += a[1] if a[0] != A[i + 1][0]: res = max(cnt,res) echo res - 1