if __name__ == '__main__':
    N = input()
    a = [int(i) for i in input().split()]

    max_a = 0
    min_a = 100
    for buf_a in a:
        if buf_a > max_a:
            max_a = buf_a

        if buf_a < min_a:
            min_a = buf_a

    print(max_a-min_a)
