#include

using namespace std;

int main() { int n; cin >> n; int arr[100] = { 0 }; int temp; int count = 0; int max, min; for (int i = 0; i < n; i++) { cin >> arr[i]; count++; } for (int i = 0; i < n; i++) { for (int j = 0; j < n - i - 1; j++) { if (arr[j] > arr[j + 1]) { temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } max = arr[count-1]; min = arr[0]; cout << max - min << endl; return 0; }