#include using namespace std; long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long sum1=0; for(int i=0;i0){ sum1+=temp; if(temp%2==1){ sum1+=1; break; } temp=temp/2; } } } return sum1; } 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; }