The question asks to compute all arithmetic sequences.

Because the clock is a 12-hour clock, one-half day has 31 arithmetic sequences, you can write all, for example, 12:34, 1:11, 1:23...2:22...11:11, etc. And 12 hours are 720 minutes.

So if the input is d minutes, one 12-hour block is d//720, total arithmetic sequences are (d//720)*31, the remind minutes are d%720, the question becomes you can count the remind minutes' arithmetic sequences. The start point is 12:00.

So compose of the hour first, then place the minutes, and check if it is an arithmetic sequence one by one.

If the number of reminding minutes' arithmetic sequence is cnt. The final result is cnt + (d//720)*31.

```
day_c = 31
h_c = 720
d = int(input())
h = 12
m = 0
cnt = 0
for i in range(d % h_c):
m += 1
if m == 60:
h += 1
m = 0
if h == 13:
h = 1
clock = str(h) + '%02d' % m
dif = int(clock[1]) - int(clock[0])
for j in range(1, len(clock)):
if int(clock[j]) - int(clock[j - 1]) != dif:
break
else:
cnt += 1
print(cnt + day_c * (d // h_c))
```

## Comments