#include<stdio.h>
int main()
{
int i,j,z,n,s[100];
while((scanf("%d",&n)!=EOF)&&n!=0)
{
int a[]={100,50,10,5,2,1};
z=0;
for(j=0;j<n;j++)
{scanf("%d",&s[j]);}
for(j=0;j<n;j++)
{
i=0;
do
{
if(s[j]/a[i]==0) i++;
z+=s[j]/a[i];
s[j]=s[j]%a[i];
}
while(s[j]/a[i]==0&&s[j]%a[i]!=0);
}
printf("%d\n",z);
}
return 0;
}
int main()
{
int i,j,z,n,s[100];
while((scanf("%d",&n)!=EOF)&&n!=0)
{
int a[]={100,50,10,5,2,1};
z=0;
for(j=0;j<n;j++)
{scanf("%d",&s[j]);}
for(j=0;j<n;j++)
{
i=0;
do
{
if(s[j]/a[i]==0) i++;
z+=s[j]/a[i];
s[j]=s[j]%a[i];
}
while(s[j]/a[i]==0&&s[j]%a[i]!=0);
}
printf("%d\n",z);
}
return 0;
}