#include<bits/stdc++.h>
using namespace std;
int f[1010],cnt,n,ans=17,k;
struct node{
int start,x;
}line[90010];
bool check(int x,int k)
{
for(int i=x;i<60;i+=k)
{
if(!f[i])
return 0;
}
return 1;
}
bool cmp(node x,node y)
{
return x.x>y.x;
}
void dfs(int x,int temp)
{
if(n<=0)
{
ans=min(ans,temp);
return ;
}
for(int i=x;i<=cnt;i++)
{
if(temp+n/line[i].x>=ans)
return ;
if(!check(line[i].start,line[i].x))
continue;
for(int j=line[i].start;j<60;j+=line[i].x)
{
n--;
f[j]--;
}
dfs(i,temp+1);
for(int j=line[i].start;j<60;j+=line[i].x)
{
n++;
f[j]++;
}
}
}
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&k);
f[k]++;
}
for(int i=0;i<60;i++)
{
if(!f[i])
continue;
for(int j=i+1;j<60;j++)
{
if(!f[j])
continue;
if(check(i,j-i))
line[++cnt]={i,j-i};
}
}
sort(line+1,line+cnt+1,cmp);
dfs(1,0);
printf("%d",ans);
return 0;
}
救救孩子吧,卡了一天了