import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static HashMap hmap; static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. int n=a.length; hmap = new HashMap(); long cost=0; for(int i=0;i