#include using namespace std; long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. int choc[a.size()]; for(int i=0;i=1){ ok=0; for(int j=0;j<5;j++){ if(choc[i]%pm[j]==0){ out=out+choc[i]; choc[i]=(int)choc[i]/pm[j]; ok=1; break; } } if(ok==0){ if(choc[i]==1) {out++;choc[i]=0;} else out=out+choc[i]+1; } } } return out; } int main() { int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } long result = longestSequence(a); cout << result << endl; return 0; }