You are given a problemset consisting of n problems. The difficulty of the i-th problem is ai. It is guaranteed that all difficulties are distinct and are given in the increasing order.
You have to assemble the contest which consists of some problems of the given problemset. In other words, the contest you have to assemble should be a subset of problems (not necessary consecutive) of the given problemset. There is only one condition that should be satisfied: for each problem but the hardest one (the problem with the maximum difficulty) there should be a problem with the difficulty greater than the difficulty of this problem but not greater than twice the difficulty of this problem. In other words, let ai1,ai2,…,aip be the difficulties of the selected problems in increasing order. Then for each j from 1 to p−1 aij+1≤aij⋅2 should hold. It means that the contest consisting of only one problem is always valid.
Among all contests satisfying the condition above you have to assemble one with the maximum number of problems. Your task is to find this number of problems.
Input
The first line of the input contains one integer n (1≤n≤2⋅105) — the number of problems in the problemset.
The second line of the input contains n integers a1,a2,…,an (1≤ai≤109) — difficulties of the problems. It is guaranteed that difficulties of the problems are distinct and are given in the increasing order.
Output
Print a single integer — maximum number of problems in the contest satisfying the condition in the problem statement.
Examples
Input
Copy
10 1 2 5 6 7 10 21 23 24 49Output
Copy
4Input
Copy
5 2 10 50 110 250Output
Copy
1Input
Copy
6 4 7 12 100 150 199Output
Copy
3
这道题比A题还要简单,少写了一个=最后被hack真心难过。。测试数据中怎么没有包含到。。。
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int n;
cin>>n;
int num=1,t=1;
int a;
cin>>a;
for(int i=1;i<n;i++)
{
int b;
cin>>b;
if(b <= a<<1)
{
t++;
if(t>num) num=t;
}
else
{
t=1;
}
a=b;
}
cout<<num<<endl;
}