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