#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *args[]) {
  int i, n = 0, m = 0xFFF, mm = -1;
  scanf("%i", &n);
  while (n--) {
    scanf("%i", &i);
    if (i > mm)
      mm = i;
    if (i < m)
      m = i;
  }
  printf("%i", mm - m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0xfff,-0x1c(%rbp)
movl   $0xffffffff,-0x20(%rbp)
lea    0xeae(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     11a8 <main+0x88>
lea    0xe8a(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1191 <main+0x71>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11a3 <main+0x83>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <main+0x3b>
mov    -0x20(%rbp),%esi
sub    -0x1c(%rbp),%esi
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,(%rsp)
lea    0xecb(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    $0xfffff000,%ebx
subl   $0x1,(%rsp)
jb     1181 <main+0x61>
mov    $0xfff,%ebp
mov    $0xffffffff,%ebx
lea    0xea7(%rip),%r14
lea    0x4(%rsp),%r15
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmp    %ebp,%eax
cmovl  %eax,%ebp
subl   $0x1,(%rsp)
jae    1160 <main+0x40>
sub    %ebp,%ebx
lea    0xe78(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 4095, i32* %8
store i32 -1, i32* %9
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %11
11: ; preds = %28, %2
%12 = load i32, i32* %7
%13 = add nsw i32 %12, -1
store i32 %13, i32* %7
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%17 = load i32, i32* %6
%18 = load i32, i32* %9
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = load i32, i32* %6
store i32 %21, i32* %9
br label %22
22: ; preds = %20, %15
%23 = load i32, i32* %6
%24 = load i32, i32* %8
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i32, i32* %6
store i32 %27, i32* %8
br label %28
28: ; preds = %26, %22
br label %11
29: ; preds = %11
%30 = load i32, i32* %9
%31 = load i32, i32* %8
%32 = sub nsw i32 %30, %31
%33 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = icmp eq i32 %8, 0
br i1 %10, label %25, label %11
11: ; preds = %2, %11
%12 = phi i32 [ %17, %11 ], [ -1, %2 ]
%13 = phi i32 [ %19, %11 ], [ 4095, %2 ]
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, %12
%17 = select i1 %16, i32 %15, i32 %12
%18 = icmp slt i32 %15, %13
%19 = select i1 %18, i32 %15, i32 %13
%20 = load i32, i32* %4
%21 = add nsw i32 %20, -1
store i32 %21, i32* %4
%22 = icmp eq i32 %20, 0
br i1 %22, label %23, label %11
23: ; preds = %11
%24 = sub nsw i32 %17, %19
br label %25
25: ; preds = %23, %2
%26 = phi i32 [ %24, %23 ], [ -4096, %2 ]
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
ret i32 0
}