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