#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[n]={0,};
int max;
int min;
for(int i = 0;i < n;i++){
cin >> arr[i];
}
max = arr[0];
for(int i = 1;i < n;i++){
if(max < arr[i]){
max = arr[i];
}
}
min = arr[0];
for(int i = 1;i < n;i++){
if(min > arr[i]){
min = arr[i];
}
}
cout << max-min;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: