#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 c, n, ret, p;
  scanf("%d", &c);
  while (c--) {
    scanf("%d", &n);
    ret = 0;
    for (p = 5; p <= n; p *= 5)
      ret += n / p;
    printf("%d\n", ret);
  }
  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>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11aa <main+0x8a>
lea    0xea6(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1196 <main+0x76>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x14(%rbp)
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
imul   $0x5,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <main+0x51>
mov    -0x10(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x8(%rsp)
jae    114d <main+0x2d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xeac(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xea3(%rip),%rbx
jmp    117f <main+0x5f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <printf@plt>
subl   $0x1,0x8(%rsp)
jb     1141 <main+0x21>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
xor    %esi,%esi
cmp    $0x5,%ecx
jl     1170 <main+0x50>
xor    %esi,%esi
mov    $0x5,%edi
nopl   0x0(%rax)
mov    %ecx,%eax
cltd
idiv   %edi
add    %eax,%esi
lea    (%rdi,%rdi,4),%edi
cmp    %ecx,%edi
jle    11a0 <main+0x80>
jmp    1170 <main+0x50>

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