#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 main(void) {
  int t, j, p;
  long long int i;
  scanf("%d", &t);
  while (t--) {
    p = 0;
    scanf("%lld", &i);
    for (j = 5; j <= i; j *= 5) {
      p = p + i / j;
    }
    printf("%d\n", p);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11c5 <main+0xa5>
movl   $0x0,-0x10(%rbp)
lea    0xea0(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x5,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     11b1 <main+0x91>
movslq -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x10(%rbp)
imul   $0x5,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1175 <main+0x55>
mov    -0x10(%rbp),%esi
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
jmp    1141 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1153 <main+0x33>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xea9(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xea2(%rip),%r12
jmp    117f <main+0x5f>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <printf@plt>
subl   $0x1,0xc(%rsp)
jb     1145 <main+0x25>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%rcx
mov    $0x0,%esi
cmp    $0x5,%rcx
jl     1170 <main+0x50>
mov    $0x5,%ebx
mov    $0x5,%edi
xor    %esi,%esi
jmp    11c4 <main+0xa4>
nopw   0x0(%rax,%rax,1)
mov    %rcx,%rax
cqto
idiv   %rdi
add    %eax,%esi
lea    (%rbx,%rbx,4),%edi
mov    %edi,%ebx
cmp    %rdi,%rcx
jl     1170 <main+0x50>
mov    %rcx,%rax
shr    $0x20,%rax
jne    11b0 <main+0x90>
mov    %ecx,%eax
xor    %edx,%edx
div    %edi
jmp    11b8 <main+0x98>

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

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