fork(1) download
  1. n = int(input())
  2. t = map(int,input().split())
  3. lst = sorted(t)
  4. if len(lst) == n:
  5. print(len(set(range(lst[0], lst[-1])) - set(lst)))
  6.  
Success #stdin #stdout 0.02s 9168KB
stdin
5
7 5 6 4 8
stdout
0