#include<cstdio>
#include<iostream>
using namespace std;
int main(){
int n;
while(scanf("%d",&n),n){
int d,ans=0;
for(int i=0;i<n;i++){
scanf("%d",&d);
ans+=d/100;d%=100;
ans+=d/50;d%=50;
ans+=d/10;d%=10;
ans+=d/5;d%=5;
ans+=d/2;d%=2;
ans+=d;
}
printf("%d\n",ans);
}
return 0;
}