A = []
for i in range(N):
  A.append(int(input()))
B = []
for j in range(N):
  B.append(1)

for j in range(N):
  for k in range(j):
    if (A[N-j-1] - A[N-k-1])*(A[N-j-1] - A[N-k-1]) <= K*K:
      B[N-j-1] = max(B[N-j-1], B[N-k-1] + 1)
print(max(B))