using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long result=0,n=0; for(int i=0;i1) { //Console.WriteLine("check1:{0}",n); if(n%2==0) { n=n/2; result+=n; } else { result+=1; break; } } } } return result; } static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] a_temp = Console.ReadLine().Split(' '); long[] a = Array.ConvertAll(a_temp,Int64.Parse); long result = longestSequence(a); Console.WriteLine(result); } }