#!/usr/bin/env pypy3 import sqlite3 def main(): connection = sqlite3.connect(":memory:") cursor = connection.cursor() cursor.execute("CREATE TABLE sequence(item INTEGER)") n = int(input()) _ = input() xs = ((int(input()), ) for _ in range(n)) cursor.executemany("INSERT INTO sequence VALUES (?)", xs) connection.commit() max_x = cursor.execute("SELECT max(item) FROM sequence").fetchone()[0] min_x = cursor.execute("SELECT min(item) FROM sequence").fetchone()[0] print(max_x - min_x) connection.close() if __name__ == '__main__': main()