#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 */
float log(int);
int /*<<< orphan*/ printf(char *, long long);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t, N;
  long long int factl, zero, i;
  float k;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &N);
    zero = 0;
    for (i = 5; i <= N; i = i + 5) {
      k = log(i) / log(5);
      if (k == (int)(k * 10) / 10)
        zero += k;
      else
        zero++;
    }
    printf("\n%lld", zero);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1244 <main+0x114>
lea    0xe9a(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x0,-0x20(%rbp)
movq   $0x5,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmp    %rcx,%rax
jg     122f <main+0xff>
mov    -0x28(%rbp),%rax
mov    %eax,%edi
call   1050 <log@plt>
movss  %xmm0,-0x30(%rbp)
mov    $0x5,%edi
call   1050 <log@plt>
movaps %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  0xe34(%rip),%xmm1
mulss  -0x2c(%rbp),%xmm1
cvttss2si %xmm1,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm1
ucomiss %xmm1,%xmm0
jne    120d <main+0xdd>
jp     120d <main+0xdd>
movss  -0x2c(%rbp),%xmm1
cvtsi2ssq -0x20(%rbp),%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
mov    %rax,-0x20(%rbp)
jmp    1219 <main+0xe9>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    121e <main+0xee>
mov    -0x28(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x28(%rbp)
jmp    1183 <main+0x53>
mov    -0x20(%rbp),%rsi
lea    0xdcd(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <main+0x1f>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x8(%rsp)
jae    1165 <main+0x35>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe98(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe8f(%rip),%r12
jmp    1194 <main+0x64>
nopw   0x0(%rax,%rax,1)
xor    %ebx,%ebx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
subl   $0x1,0x8(%rsp)
jb     1155 <main+0x25>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
cmpl   $0x5,0x4(%rsp)
jl     1180 <main+0x50>
mov    $0x5,%r13d
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %r13d,%edi
call   1050 <log@plt>
movss  %xmm0,0xc(%rsp)
mov    $0x5,%edi
call   1050 <log@plt>
movss  0xc(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
mulss  0xe23(%rip),%xmm0
cvttss2si %xmm0,%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
ucomiss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %rbx,%xmm0
lea    0x1(%rbx),%rax
addss  %xmm1,%xmm0
cvttss2si %xmm0,%rbx
cmovne %rax,%rbx
cmovp  %rax,%rbx
add    $0x5,%r13
movslq 0x4(%rsp),%rax
cmp    %rax,%r13
jle    11b0 <main+0x80>
jmp    1182 <main+0x52>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"\0A%lld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %46, %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = icmp ne i32 %10, 0
br i1 %12, label %13, label %49
13: ; preds = %9
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i64 0, i64* %5
store i64 5, i64* %6
br label %15
15: ; preds = %43, %13
%16 = load i64, i64* %6
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = icmp sle i64 %16, %18
br i1 %19, label %20, label %46
20: ; preds = %15
%21 = load i64, i64* %6
%22 = trunc i64 %21 to i32
%23 = call float @log(i32 %22)
%24 = call float @log(i32 5)
%25 = fdiv float %23, %24
store float %25, float* %7
%26 = load float, float* %7
%27 = load float, float* %7
%28 = fmul float %27, 1.000000e+01
%29 = fptosi float %28 to i32
%30 = sdiv i32 %29, 10
%31 = sitofp i32 %30 to float
%32 = fcmp oeq float %26, %31
br i1 %32, label %33, label %39
33: ; preds = %20
%34 = load float, float* %7
%35 = load i64, i64* %5
%36 = sitofp i64 %35 to float
%37 = fadd float %36, %34
%38 = fptosi float %37 to i64
store i64 %38, i64* %5
br label %42
39: ; preds = %20
%40 = load i64, i64* %5
%41 = add nsw i64 %40, 1
store i64 %41, i64* %5
br label %42
42: ; preds = %39, %33
br label %43
43: ; preds = %42
%44 = load i64, i64* %6
%45 = add nsw i64 %44, 5
store i64 %45, i64* %6
br label %15
46: ; preds = %15
%47 = load i64, i64* %5
%48 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %47)
br label %9
49: ; preds = %9
ret i32 0
}

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