import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long f(long p) { if(p==1) { return 1; } if(p==2) { return 3; } if(p%2!=0) { return p+1; } return (f(p/2)*2+2); } static long longestSequence(long[] a) { long t=0; for(int i=0;i