fork download
  1.  
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. Scanner sc = new Scanner(System.in);
  11. int n = sc.nextInt();
  12. int num = Integer.MAX_VALUE;
  13. for(int i=0;i<n;i++){
  14. int elem = sc.nextInt();
  15. num = Math.min(Math.abs(0-elem),num);
  16. }
  17. System.out.println(num);
  18. }
  19. }
Success #stdin #stdout 0.12s 54416KB
stdin
3
2 -6 5
stdout
2