import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int solve(int[] A) { // Return the length of the longest possible sequence of moves modulo 10^9+7. Arrays.sort(A); //BigInteger res = new BigInteger(""); long res=0; int n = A.length; int x=0,i=0; //System.out.println(n); for(;i