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