#include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n&&n!=0)
{
int sum=0,a,teacher;
for(int i=1;i<=n;i++)
{
cin>>teacher;
sum+=teacher/100;
teacher=teacher%100;
sum+=teacher/50;
teacher=teacher%50;
sum+=teacher/10;
teacher=teacher%10;
sum+=teacher/5;
teacher=teacher%5;
sum+=teacher/2;
teacher=teacher%2;
sum+=teacher/1;
}
cout<<sum<<endl;
}
}
using namespace std;
int main()
{
int n;
while(cin>>n&&n!=0)
{
int sum=0,a,teacher;
for(int i=1;i<=n;i++)
{
cin>>teacher;
sum+=teacher/100;
teacher=teacher%100;
sum+=teacher/50;
teacher=teacher%50;
sum+=teacher/10;
teacher=teacher%10;
sum+=teacher/5;
teacher=teacher%5;
sum+=teacher/2;
teacher=teacher%2;
sum+=teacher/1;
}
cout<<sum<<endl;
}
}