#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 t;
  scanf("%d", &t);
  int i;
  for (i = 0; i < t; i++) {
    int n, c = 5, z = 0;
    scanf("%d", &n);
    while ((n / c) != 0) {
      z += (n / c);
      c = c * 5;
    }
    printf("%d\n", z);
  }
  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
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b6 <main+0x96>
movl   $0x5,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe99(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%eax
je     1199 <main+0x79>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0x5,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1170 <main+0x50>
mov    -0x18(%rbp),%esi
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    11c0 <main+0xa0>
xor    %ebp,%ebp
lea    0xeb7(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xeae(%rip),%rbx
jmp    1170 <main+0x50>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    (%rsp),%ebp
jge    11c0 <main+0xa0>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
lea    0x4(%rcx),%eax
mov    $0x0,%esi
cmp    $0x9,%eax
jb     1160 <main+0x40>
movslq %ecx,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rax
add    %edx,%eax
mov    $0x5,%edi
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
add    %eax,%esi
lea    (%rdi,%rdi,4),%edi
mov    %ecx,%eax
cltd
idiv   %edi
test   %eax,%eax
jne    11b0 <main+0x90>
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
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 i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %8
8: ; preds = %30, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %33
12: ; preds = %8
store i32 5, i32* %5
store i32 0, i32* %6
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %14
14: ; preds = %19, %12
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = sdiv i32 %15, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %14
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = sdiv i32 %20, %21
%23 = load i32, i32* %6
%24 = add nsw i32 %23, %22
store i32 %24, i32* %6
%25 = load i32, i32* %5
%26 = mul nsw i32 %25, 5
store i32 %26, i32* %5
br label %14
27: ; preds = %14
%28 = load i32, i32* %6
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %8
33: ; preds = %8
ret i32 0
}

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 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %31
7: ; preds = %0
%8 = bitcast i32* %2 to i8*
br label %9
9: ; preds = %7, %25
%10 = phi i32 [ 0, %7 ], [ %28, %25 ]
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = add i32 %12, 4
%14 = icmp ult i32 %13, 9
br i1 %14, label %25, label %15
15: ; preds = %9
%16 = sdiv i32 %12, 5
br label %17
17: ; preds = %15, %17
%18 = phi i32 [ %23, %17 ], [ %16, %15 ]
%19 = phi i32 [ %21, %17 ], [ 0, %15 ]
%20 = phi i32 [ %22, %17 ], [ 5, %15 ]
%21 = add nsw i32 %18, %19
%22 = mul nuw nsw i32 %20, 5
%23 = sdiv i32 %12, %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %17
25: ; preds = %17, %9
%26 = phi i32 [ 0, %9 ], [ %21, %17 ]
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = add nuw nsw i32 %10, 1
%29 = load i32, i32* %1
%30 = icmp slt i32 %28, %29
br i1 %30, label %9, label %31
31: ; preds = %25, %0
ret i32 0
}