#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 */
scalar_t__ floor(long);
long pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, long *);
int main(void) {
  long t, n;
  int i, no_zeros = 0;
  scanf("%ld", &t);
  while (t--) {
    scanf("%ld", &n);
    for (i = 1; n >= pow(5, i); i++) {
      no_zeros += floor(n / pow(5, i));
    }
    printf("%d\n", no_zeros);
    no_zeros = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     121a <main+0xda>
lea    0xe7a(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%esi
mov    $0x5,%edi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jl     11ff <main+0xbf>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%esi
mov    $0x5,%edi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,%rdi
call   1060 <floor@plt>
mov    %rax,%rcx
movslq -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1196 <main+0x56>
mov    -0x20(%rbp),%esi
lea    0xdfb(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
jmp    1166 <main+0x26>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeab(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <scanf@plt>
subq   $0x1,0x10(%rsp)
jae    1178 <main+0x38>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe81(%rip),%r14
lea    0x8(%rsp),%r15
lea    0xe79(%rip),%r12
jmp    11a3 <main+0x63>
nopl   (%rax)
mov    %r12,%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
subq   $0x1,0x10(%rsp)
jb     1167 <main+0x27>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%rbx
mov    $0x1,%ebp
mov    $0x5,%edi
mov    $0x1,%esi
call   1050 <pow@plt>
mov    $0x0,%r13d
jmp    11f7 <main+0xb7>
nop
mov    %rbx,%rax
cqto
idiv   %rcx
mov    %rax,%rdi
call   1060 <floor@plt>
add    %eax,%r13d
add    $0x1,%ebp
mov    0x8(%rsp),%rbx
mov    $0x5,%edi
mov    %ebp,%esi
call   1050 <pow@plt>
cmp    %rax,%rbx
jl     1190 <main+0x50>
mov    0x8(%rsp),%rbx
mov    $0x5,%edi
mov    %ebp,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
or     %rbx,%rax
shr    $0x20,%rax
jne    11d0 <main+0x90>
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
jmp    11db <main+0x9b>

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

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