// Finding smallest and largest of 'n' number.
import java.util.*;
class SmallLarge
{
	public static void main(String args[])
	{
		int n, i, small, large, a[]= new int[30];
		Scanner in = new Scanner(System.in);
		System.out.println("\nFinding smallest and largest number:-\n");
		System.out.print("How many numbers? ");
		n = in.nextInt();
		System.out.print("\nEnter those numbers? ");
		for( i = 0; i < n; i++ )
		{
			a[i] = in.nextInt();
		}
		small = large = a[0];
		for( i = 1; i < n; i++ )
		{
			if(a[i] > large)
				large = a[i];
			else if (a[i] < small)
				small = a[i];
		}
		System.out.println("\nSmallest number is " + small);
		System.out.println("\nLargest number is " + large);
	}
}