import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(int n,long[] a) { // Return the length of the longest possible sequence of moves. HashMap map = new HashMap<>(); map.put(1L,1L); map.put(2L,3L); map.put(6L,10L); map.put(7L,8L); map.put(24L,46L); Long total = 0L; for(int i=0;i map) { if(map.containsKey(a)) return map.get(a); long val; long max = a+1; for(long i=2;i<=Math.sqrt(a);i++) { if(a%i==0) { val = 1; val += i*func(a/i,map); if(max