#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
signed main(){
int n;
cin>>n;
vector<int>a;
map<int,int>mp,temp;
for(int i=0;i<n;i++){
int x1;
cin>>x1;
mp[x1]++;
temp[x1]++;
}
int x;
cin>>x;
int fact=0;
int cnt=0;
int ma=mp[x];
//特判当所有种子都小于x时即为0
for(auto it:mp){
int first=it.first;
if(first>=x)cnt=1;
}
if(cnt==0){
cout<<0;
return 0;
}
//两个哈希表进行存储
while(1){
fact=0;
mp=temp;
temp.clear();
for(auto it:mp){
int first=it.first;
//退出条件是所有的值都小于x
if(first>x)fact=1;
//进行模拟上取整
if(first%3==0){
temp[first/3]+=it.second*2;
}else {
temp[first/3+1]+=it.second*2;
}
}
//更新最大值
ma=max(ma,temp[x]);
if(fact==0)break;
}
cout<<ma;
return 0;
}