The First Meeting

0

0 votes
Easy, Math
Problem

Given an array, A, of length N. Find the absolute difference between the smallest and largest prime number in array A.

Input:
First line contains an integer, N, number of points.
Second line contains N space separated integers, Ai, denoting the elements of the array A.

Output:
Print the absolute difference between the smallest and largest prime number in array A, otherwise 1.

Constraints:
1N106
1Ai106

Sample Input
5
1 2 3 4 5
Sample Output
3
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

A={1,2,3,4,5}.
Largest prime is 5 and smallest prime is 2. So the answer will be 52=3.

Contributers:
Editor Image

?