题目描述
Problem Description
Takahashi recorded his recent daily life as a sequence of length $2N$ as follows:
- $a_1, b_1, a_2, b_2, \ldots, a_N, b_N$
This represents that Takahashi started his day at a certain time $T$ and followed a routine where:
- He slept for exactly $a_1$ seconds.
- Then he stayed awake for exactly $b_1$ seconds.
- Then he slept for exactly $a_2$ seconds.
- (omitted)
- Then he slept for exactly $a_N$ seconds.
- Then he stayed awake for exactly $b_N$ seconds.
In this record, Takahashi woke up $N$ times.
Takahashi is curious about how many times he woke up early.
Here, "waking up early" refers to waking up between 4 AM and 7 AM. Waking up exactly at 4 AM or 7 AM also counts as waking up early.
If he wakes up during this time period on the same day more than once, it counts as multiple early risings.
However, Takahashi forgot the time $T$.
Find the maximum number of times he could have woken up early out of the $N$ times.
Note that a day has $86400$ seconds, and the time between 4 AM and 7 AM is $10800$ seconds.
Input Format
The input is given from the standard input in the following format:
$N$ $a_1$ $b_1$ $a_2$ $b_2$ $:$ $a_N$ $b_N$
Output Format
Output the maximum number of times he could have woken up early out of the $N$ times.
Sample Input and Output
Sample Input #1
3
28800 57600
28800 57600
57600 28800
Sample Output #1
2
Sample Input #2
10
28800 57600
4800 9600
6000 1200
600 600
300 600
5400 600
6000 5760
6760 2880
6000 12000
9000 600
Sample Output #2
5
Notes/Hints
Constraints
- $1 \leq N \leq 10^5$
- $1 \leq a_i, b_i \leq 10^5$
- $a_i, b_i$ are both integers.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分