import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long leastDivisor(long n){ long factor = 1; for(int i=3;i<=Math.sqrt(n);i+=2){ if(n%i==0){ return i; } } return factor; } static long noOfMoves(long l){ if(l==1){ return 1; } else if(l%2==0){ return l + noOfMoves(l/2); } else if(leastDivisor(l)==1) { return l + 1; } else{ return l + noOfMoves(l/leastDivisor(l)); } } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long totalMoves = 0; for(int i=0;i