import java.util.Scanner; import java.util.ArrayList; public class Main { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); Integer n=scanner.nextInt(); ArrayList v=new ArrayList<>(); for(int i=0;i dp=new ArrayList<>(); dp.add(v.get(0)); dp.add(Math.max(dp.get(0),v.get(1))); for(int i=2;i