import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { int n; Scanner s=new Scanner(System.in); n=s.nextInt(); int flag=0,flag1=0,output=0; for(int i=0;i