#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int N = 1 << 17;
const int INF = 1e9 + 47;
int Tmin[4 * N], Tmax[4 * N];
int n;
int mn(int l, int r, int id = 1, int tl = 0, int tr = N - 1)
{
if (l == tl && r == tr)
return Tmin[id];
int m = (tl + tr) / 2;
if (r <= m)
return mn(l, r, id * 2, tl, m);
else if (l > m)
return mn(l, r, id * 2 + 1, m + 1, tr);
else
return min(mn(l, m, id * 2, tl, m), mn(m + 1, r, id * 2 + 1, m + 1, tr));
}
int mx(int l, int r, int id = 1, int tl = 0, int tr = N - 1)
{
if (l == tl && r == tr)
return Tmax[id];
int m = (tl + tr) / 2;
if (r <= m)
return mx(l, r, id * 2, tl, m);
else if (l > m)
return mx(l, r, id * 2 + 1, m + 1, tr);
else
return max(mx(l, m, id * 2, tl, m), mx(m + 1, r, id * 2 + 1, m + 1, tr));
}
void setMin(int i, int d, int id = 1, int tl = 0, int tr = N - 1)
{
if (tl == tr)
{
Tmin[id] = d;
return;
}
int m = (tl + tr) / 2;
if (i <= m)
setMin(i, d, id * 2, tl, m);
else
setMin(i, d, id * 2 + 1, m + 1, tr);
Tmin[id] = min(Tmin[id * 2], Tmin[id * 2 + 1]);
}
void setMax(int i, int d, int id = 1, int tl = 0, int tr = N - 1)
{
if (tl == tr)
{
Tmax[id] = d;
return;
}
int m = (tl + tr) / 2;
if (i <= m)
setMax(i, d, id * 2, tl, m);
else
setMax(i, d, id * 2 + 1, m + 1, tr);
Tmax[id] = max(Tmax[id * 2], Tmax[id * 2 + 1]);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
for (int i = 0; i < 4 * N; i++)
{
Tmin[i] = INF;
Tmax[i] = 0;
}
cin >> n;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; i++) cin >> a[i].first;
for (int i = 0; i < n; i++) cin >> a[i].second;
sort(a.begin(), a.end());
vector<int> L(n), R(n);
L[0] = 0;
setMin(0, 0);
for (int i = 1; i < n; i++)
{
int j = lower_bound(a.begin(), a.end(), make_pair(a[i].first - a[i].second, -1)) - a.begin();
L[i] = min(i, mn(j, i));
setMin(i, L[i]);
}
R[n - 1] = n - 1;
setMax(n - 1, n - 1);
for (int i = n - 2; i >= 0; i--)
{
int j = upper_bound(a.begin(), a.end(), make_pair(a[i].first + a[i].second, INF)) - a.begin();
R[i] = max(i, mx(i, j - 1));
setMax(i, R[i]);
}
int ans = 1;
for (int i = 0; i < n; i++)
{
ans = max(ans, R[i] - L[i] + 1);
}
cout << ans << endl;
}