Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define REP(i,n) for(i=0;i<n;i++)

#define MOD 1000000007

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);
void sortAsc(int *a);
void sortDesc(int *a);
int asc(const void *a, const void *b);
int desc(const void *a, const void *b);
void llSortAsc(long long *a);
void llSortDesc(long long *a);
int llAsc(const void *a, const void *b);
int llDesc(const void *a, const void *b);
double toDeg(double rad);
double distance(int xi, int yi, int xj, int yj);

//main function
int main() {
    int n = iin(), i, a, a_min = MOD, a_max = -1;
    REP(i,n) {
        a = iin();
        if (a < a_min) a_min = a;
        if (a > a_max) a_max = a;
    }
    iout(a_max - a_min);
    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

/*
    int型の最大公約数
*/

int gcd(int a, int b) {
    int r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    int型の最小公倍数
*/

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    long long型の最大公約数
*/

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

/*
    long long型の最小公倍数
*/

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}

/*
    int型の昇順ソート
*/

void sortAsc(int *a) {
    qsort(a, sizeof(a), sizeof(int), sizeof(int), asc);
}

/*
    int型の降順ソート
*/

void sortDesc(int *a) {
    qsort(a, sizeof(a), sizeof(int), sizeof(int), desc);
}

/*
    int型の昇順用比較関数
*/

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

/*
    int型の降順用比較関数
*/

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

/*
    long long型の昇順ソート
*/

void llSortAsc(long long *a) {
    qsort(a, sizeof(a), sizeof(long long), sizeof(long long), llAsc);
}

/*
    long long型の降順ソート
*/

void llSortDesc(long long *a) {
    qsort(a, sizeof(a), sizeof(long long), sizeof(long long), llDesc);
}

/*
    long long型の昇順用比較関数
*/

int llAsc(const void *a, const void *b) {
    long long *A = (long long *)a;
    long long *B = (long long *)b;
    if (*A > *B) return 1;
    else if (*A < *B) return -1;
    else return 0;
}

/*
    long long型の降順用比較関数
*/

int llDesc(const void *a, const void *b) {
    long long *A = (long long *)a;
    long long *B = (long long *)b;
    if (*A < *B) return 1;
    else if (*A > *B) return -1;
    else return 0;
}

/*
    弧度法を度数法に
*/

double toDeg(double rad) {
    return rad * 180.0 / (atan(1.0) * 4.0);
}

/*
    二点間の距離
*/

double distance(int xi, int yi, int xj, int yj) {
    return hypot(xj - xi, yj - yi);
}


Compiler output:
main.c: In function 'sortAsc':
main.c:169:38: error: passing argument 4 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
  169 |     qsort(a, sizeof(a), sizeof(int), sizeof(int), asc);
      |                                      ^~~~~~~~~~~
      |                                      |
      |                                      long unsigned int
In file included from main.c:2:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'long unsigned int'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
main.c:169:5: error: too many arguments to function 'qsort'
  169 |     qsort(a, sizeof(a), sizeof(int), sizeof(int), asc);
      |     ^~~~~
/usr/include/stdlib.h:970:13: note: declared here
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |             ^~~~~
main.c: In function 'sortDesc':
main.c:177:38: error: passing argument 4 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
  177 |     qsort(a, sizeof(a), sizeof(int), sizeof(int), desc);
      |                                      ^~~~~~~~~~~
      |                                      |
      |                                      long unsigned int
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'long unsigned int'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
main.c:177:5: error: too many arguments to function 'qsort'
  177 |     qsort(a, sizeof(a), sizeof(int), sizeof(int), desc);
      |     ^~~~~
/usr/include/stdlib.h:970:13: note: declared here
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |             ^~~~~
main.c: In function 'llSortAsc':
main.c:201:44: error: passing argument 4 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
  201 |     qsort(a, sizeof(a), sizeof(long long), sizeof(long long), llAsc);
      |                                            ^~~~~~~~~~~~~~~~~
      |                                            |
      |                                            long unsigned int
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'long unsigned int'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
main.c:201:5: error: too many arguments to function 'qsort'
  201 |     qsort(a, sizeof(a), sizeof(long long), sizeof(long long), llAsc);
      |     ^~~~~
/usr/include/stdlib.h:970:13: note: declared here
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |             ^~~~~
main.c: In function 'llSortDesc':
main.c:209:44: error: passing argument 4 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
  209 |     qsort(a, sizeof(a), sizeof(long long), sizeof(long long), llDesc);
      |                                            ^~~~~~~~~~~~~~~~~
      |                                            |
      |                                            long unsigned int
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'long unsigned int'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
main.c:209:5: error: too many arguments to function 'qsort'
  209 |     qsort(a, sizeof(a), sizeof(long long), sizeof(long long), llDesc);
      |     ^~~~~
/usr/include/stdlib.h:970:13: note: declared here
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |             ^~~~~