#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 a = 0;
  scanf("%d", &a);
  int count = 0;
  long int n;
  int b[a];
  int i;
  for (i = 0; i < a; i++)
    scanf("%d", &b[i]);
  for (i = 0; i < a; i++) {
    count = 0;
    int x;
    for (x = 5; b[i] / x >= 1; x *= 5)
      count += b[i] / x;
    printf("%d\n", count);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <main+0x90>
mov    -0x38(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe63(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    117b <main+0x5b>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1227 <main+0x107>
movl   $0x0,-0xc(%rbp)
movl   $0x5,-0x30(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cltd
idivl  -0x30(%rbp)
cmp    $0x1,%eax
jl     120a <main+0xea>
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cltd
idivl  -0x30(%rbp)
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
imul   $0x5,-0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    11d1 <main+0xb1>
mov    -0xc(%rbp),%esi
lea    0xdef(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b7 <main+0x97>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,-0x2c(%rbp)
lea    0xec4(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rsp,%r15
mov    -0x2c(%rbp),%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    1210 <main+0xf0>
xor    %r13d,%r13d
lea    0xe8c(%rip),%r14
mov    %r12,%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rax
add    $0x4,%rbx
cmp    %rax,%r13
jl     1180 <main+0x60>
test   %eax,%eax
jle    1210 <main+0xf0>
xor    %ebx,%ebx
mov    $0xcccccccd,%r13d
lea    0xe54(%rip),%r14
jmp    11d5 <main+0xb5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jge    1210 <main+0xf0>
mov    (%r12,%rbx,4),%ecx
mov    $0x0,%esi
cmp    $0x5,%ecx
jl     11c0 <main+0xa0>
mov    %ecx,%eax
imul   %r13,%rax
shr    $0x22,%rax
xor    %esi,%esi
mov    $0x5,%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %eax,%esi
lea    (%rdi,%rdi,4),%edi
mov    %ecx,%eax
cltd
idiv   %edi
test   %eax,%eax
jg     1200 <main+0xe0>
jmp    11c0 <main+0xa0>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i32, i64 %11
store i64 %11, i64* %6
store i32 0, i32* %7
br label %14
14: ; preds = %23, %0
%15 = load i32, i32* %7
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %13, i64 %20
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
br label %23
23: ; preds = %18
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %14
26: ; preds = %14
store i32 0, i32* %7
br label %27
27: ; preds = %55, %26
%28 = load i32, i32* %7
%29 = load i32, i32* %2
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %58
31: ; preds = %27
store i32 0, i32* %3
store i32 5, i32* %8
br label %32
32: ; preds = %49, %31
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %13, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %8
%38 = sdiv i32 %36, %37
%39 = icmp sge i32 %38, 1
br i1 %39, label %40, label %52
40: ; preds = %32
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %13, i64 %42
%44 = load i32, i32* %43
%45 = load i32, i32* %8
%46 = sdiv i32 %44, %45
%47 = load i32, i32* %3
%48 = add nsw i32 %47, %46
store i32 %48, i32* %3
br label %49
49: ; preds = %40
%50 = load i32, i32* %8
%51 = mul nsw i32 %50, 5
store i32 %51, i32* %8
br label %32
52: ; preds = %32
%53 = load i32, i32* %3
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %52
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %27
58: ; preds = %27
store i32 0, i32* %1
%59 = load i8*, i8** %5
%60 = load i32, i32* %1
ret i32 %60
}

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