#include
#include
using namespace std;
int main(){
int n;
vector a;
int temp;
int count;
int n1, n2, n3, n4, n5, n6;
while(cin >> n){
if(n == 0){
break;
}
else{
a.clear();
count = 0;
for(int i = 0 ;i < n; i++){
cin >> temp;
a.push_back(temp);
}//测试也有讲究,用一组"100 50 10 5 2 1"来测发现有问题了 ,找特殊的测试样例
for(int i = 0 ;i < n; i++){
n1 = a[i] / 100; a[i] -= 100 * (a[i] / 100);//每次要减去,才符合实际,不然是错的
n2 = a[i] / 50; a[i] -= 50 * (a[i] / 50);
n3 = a[i] / 10; a[i] -= 10 * (a[i] / 10);
n4 = a[i] / 5; a[i] -= 5 * (a[i] / 5);
n5 = a[i] / 2; a[i] -= 2 * (a[i] / 2);
n6 = a[i] / 1;
count += n1 + n2 + n3 + n4 + n5 + n6;
}
cout << count << endl;
}
}
return 0;
}