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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xea5(%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     11f6 <main+0xc6>
lea    0xe81(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11e2 <main+0xb2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x5,%edi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11a3 <main+0x73>
mov    -0x10(%rbp),%esi
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
jmp    1164 <main+0x34>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jae    1164 <main+0x34>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe95(%rip),%r14
mov    %rsp,%r15
lea    0xe8e(%rip),%r12
jmp    1191 <main+0x61>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
subl   $0x1,0x4(%rsp)
jb     1153 <main+0x23>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq (%rsp),%rbp
imul   $0x66666667,%rbp,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x21,%rbx
add    %eax,%ebx
lea    0x4(%rbp),%eax
cmp    $0x9,%eax
jb     1180 <main+0x50>
mov    $0x5,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
add    %eax,%ebx
test   %eax,%eax
je     1180 <main+0x50>
mov    $0x3,%ebp
nopl   (%rax)
mov    (%rsp),%r13d
mov    $0x5,%edi
mov    %ebp,%esi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    %r13d,%eax
cltd
idiv   %ecx
add    %eax,%ebx
add    $0x1,%ebp
test   %eax,%eax
jne    11e0 <main+0xb0>
jmp    1180 <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
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %30, %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %33
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %3
%15 = sdiv i32 %14, 5
store i32 %15, i32* %4
%16 = load i32, i32* %4
store i32 %16, i32* %6
store i32 1, i32* %5
br label %17
17: ; preds = %20, %12
%18 = load i32, i32* %6
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
%23 = load i32, i32* %3
%24 = load i32, i32* %5
%25 = call i32 @pow(i32 5, i32 %24)
%26 = sdiv i32 %23, %25
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = load i32, i32* %4
%29 = add nsw i32 %28, %27
store i32 %29, i32* %4
br label %17
30: ; preds = %17
%31 = load i32, i32* %4
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %31)
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 = 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 %35, label %9
9: ; preds = %0, %29
%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 = sdiv i32 %11, 5
%13 = add i32 %11, 4
%14 = icmp ult i32 %13, 9
br i1 %14, label %29, label %15
15: ; preds = %9
%16 = call i32 @pow(i32 5, i32 2)
%17 = sdiv i32 %11, %16
%18 = add nsw i32 %17, %12
%19 = icmp eq i32 %17, 0
br i1 %19, label %29, label %20
20: ; preds = %15, %20
%21 = phi i32 [ %27, %20 ], [ %18, %15 ]
%22 = phi i32 [ %24, %20 ], [ 2, %15 ]
%23 = load i32, i32* %2
%24 = add nuw nsw i32 %22, 1
%25 = call i32 @pow(i32 5, i32 %24)
%26 = sdiv i32 %23, %25
%27 = add nsw i32 %26, %21
%28 = icmp eq i32 %26, 0
br i1 %28, label %29, label %20
29: ; preds = %20, %15, %9
%30 = phi i32 [ %12, %9 ], [ %18, %15 ], [ %27, %20 ]
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %1
%33 = add nsw i32 %32, -1
store i32 %33, i32* %1
%34 = icmp eq i32 %32, 0
br i1 %34, label %35, label %9
35: ; preds = %29, %0
ret i32 0
}