#include<iostream> using namespace std; int main() { int n,i,count=0,t; while (cin >> n&&n!=0) { int a[100]; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] != 0) //进行计数 { if (a[i] >= 100) { t = a[i] / 100; a[i] = a[i] % 100; count += t; } if (50 <= a[i] < 100) { t = a[i] / 50; a[i] = a[i] % 50; count += t; } if (10 <= a[i] < 50) { t = a[i] / 10; a[i] = a[i] % 10; count += t; } if (5 <= a[i] < 10) { t = a[i] / 5; a[i] = a[i] % 5; count += t; } if (2 <= a[i] < 5) { t = a[i] / 2; a[i] = a[i] % 2; count += t; } if (1 <= a[i] < 2) { t = a[i] / 1; a[i] = a[i] % 1; count += t; } } } cout << count << endl; count = 0; } return 0; }