#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)



int N;
int imos[101010];
//-----------------------------------------------------------------
int main() {
	cin >> N;

	int t = 0;
	rep(i, 0, N) {
		int a, b;
		scanf("%d %d", &a, &b);

		t = (t + a) % 86400;

		int l = (86400 - t) % 86400;
		int r = (l + 10800) % 86400;

		if (l < r) {
			imos[l]++;
			imos[r + 1]--;
		}
		else {
			imos[0]++;
			imos[r + 1]--;
			imos[l]++;
		}
		
		t = (t + b) % 86400;
	}

	rep(i, 1, 86401) imos[i] += imos[i - 1];

	int ans = 0;
	rep(i, 0, 86401) ans = max(ans, imos[i]);
	cout << ans << endl;
}