#K52062. Smallest Time Interval

    ID: 29226 Type: Default 1000ms 256MiB

Smallest Time Interval

Smallest Time Interval

You are given a list of timestamps in the (HH:MM) format on a 24-hour clock. Your task is to find the smallest interval (in minutes) between any two timestamps. Note that the day wraps around at midnight; hence, you must also consider the interval between the last and the first timestamp in sorted order. If there is only one timestamp, output "No interval".

For example, if the timestamps are 05:30, 23:50, and 00:05, the smallest interval is 15 minutes.

inputFormat

The input consists of multiple lines. The first line contains a single integer (n) representing the number of timestamps. Each of the following (n) lines contains a timestamp in the (HH:MM) format.

outputFormat

Print a single line containing the smallest interval in minutes between any two timestamps. If there is only one timestamp, print "No interval".## sample

1
12:45
No interval