import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a,int n) { long[] a1= new long[n];long t=0,a3=1,sum=0,sum1=0; for(int i=0;i=2) { if(a[i]%2!=0) { sum=1; } else{ sum=0; long a2=a[i]; while(a2>=2) { a2/=2; sum=sum+a2; } } a1[i]=sum + a[i]; } else{ a1[i]=1; } } for(int i=0;i