nums = map(int, input().split()) ns = nums[2:] M = max(ns) - min(ns) print(M)