#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*/ fib(long long);
long long gcd(long long, long long);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int n;
  long long int a, b, g;
  scanf("%d", &n);
  if (n >= 2) {
    scanf("%lld", &a);
    scanf("%lld", &b);
    g = gcd(a, b);
    n = n - 2;
    while (n--) {
      scanf("%lld", &a);
      if (g != 1) {
        g = gcd(g, a);
      }
    }
    printf("%lld\n", fib(g));
  } else {
    scanf("%lld", &a);
    printf("%lld\n", fib(a));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x2,-0x8(%rbp)
jl     120c <main+0xcc>
lea    0xe91(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe7f(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <gcd@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11f0 <main+0xb0>
lea    0xe3f(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpq   $0x1,-0x20(%rbp)
je     11eb <main+0xab>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <gcd@plt>
mov    %rax,-0x20(%rbp)
jmp    11a9 <main+0x69>
mov    -0x20(%rbp),%rdi
call   1050 <fib@plt>
mov    %eax,%esi
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
jmp    1235 <main+0xf5>
lea    0xdf0(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fib@plt>
mov    %eax,%esi
lea    0xdd8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xeb0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
lea    0xe9c(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x2,%ebx
jl     11b2 <main+0x72>
lea    0xe84(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
call   1060 <gcd@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%eax
lea    -0x3(%rax),%ecx
mov    %ecx,0xc(%rsp)
cmp    $0x2,%eax
jne    11d9 <main+0x99>
mov    %rbx,%rax
jmp    11b7 <main+0x77>
mov    0x10(%rsp),%rax
mov    %rax,%rdi
call   1050 <fib@plt>
lea    0xe42(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe23(%rip),%r14
lea    0x10(%rsp),%r15
jmp    11fa <main+0xba>
nopw   0x0(%rax,%rax,1)
subl   $0x1,0xc(%rsp)
mov    %rax,%rbx
jb     11b7 <main+0x77>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    $0x1,%eax
cmp    $0x1,%rbx
je     11f0 <main+0xb0>
mov    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <gcd@plt>
jmp    11f0 <main+0xb0>

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

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