import sequtils, strutils let n = parseInt readLine stdin xs = (0 ..< n).mapIt split readLine stdin proc fn(s: string): int = var h, m: int (h, m) = s.split(':').map parseInt h * 60 + m var ans = 0 for x in xs: var t = x[1].fn - x[0].fn if t < 0: t.inc (24 * 60) ans.inc t echo ans