#include using namespace std; int main(){ int n; while (cin >> n && n!=0){ int r100=0,r50=0,r10=0,r5=0,r2=0,r1=0,tmp; for(;n>0;n--){ cin >> tmp; for(;tmp>=100;tmp-=100) r100++; for(;tmp>=50;tmp-=50) r50++; for(;tmp>=10;tmp-=10) r10++; for(;tmp>=5;tmp-=5) r5++; for(;tmp>=2;tmp-=2) r2++; for(;tmp>=1;tmp-=1) r1++; } cout << r100+r50+r10+r5+r2+r1 << endl; } return 0; }