#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() {
  int n, i = 0, t, in, p = 1, sum;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &in);
    while (1) {
      t = in / pow(5, p);
      sum = sum + t;
      p++;
      if (pow(5, p) > in)
        break;
    }
    printf("%d\n", sum);
    sum = 0;
    p = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fb <main+0xcb>
lea    0xe89(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%esi
mov    $0x5,%edi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    $0x5,%edi
call   1050 <pow@plt>
cmp    -0x14(%rbp),%eax
jle    11cb <main+0x9b>
jmp    11d0 <main+0xa0>
jmp    1180 <main+0x50>
mov    -0x1c(%rbp),%esi
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
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>
cmpl   $0x0,0x4(%rsp)
jle    11c3 <main+0x93>
xor    %r14d,%r14d
mov    %rsp,%r15
lea    0xea3(%rip),%r12
lea    0xe99(%rip),%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    $0x2,%ebx
mov    (%rsp),%ebp
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%esi
mov    $0x5,%edi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
add    %eax,%r13d
mov    $0x5,%edi
mov    %ebx,%esi
call   1050 <pow@plt>
mov    (%rsp),%ebp
add    $0x1,%ebx
cmp    %ebp,%eax
jle    1180 <main+0x50>
mov    %r12,%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
jl     1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
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
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1, i32* %6
%8 = 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 %9
9: ; preds = %34, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
br label %15
15: ; preds = %13, %30
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call i32 @pow(i32 5, i32 %17)
%19 = sdiv i32 %16, %18
store i32 %19, i32* %4
%20 = load i32, i32* %7
%21 = load i32, i32* %4
%22 = add nsw i32 %20, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = call i32 @pow(i32 5, i32 %25)
%27 = load i32, i32* %5
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %15
br label %31
30: ; preds = %15
br label %15
31: ; preds = %29
%32 = load i32, i32* %7
%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* %7
store i32 1, i32* %6
br label %34
34: ; preds = %31
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %9
37: ; preds = %9
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 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %28
8: ; preds = %0, %23
%9 = phi i32 [ %25, %23 ], [ 0, %0 ]
%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
br label %12
12: ; preds = %12, %8
%13 = phi i32 [ %11, %8 ], [ %21, %12 ]
%14 = phi i32 [ 1, %8 ], [ %19, %12 ]
%15 = phi i32 [ 0, %8 ], [ %18, %12 ]
%16 = call i32 @pow(i32 5, i32 %14)
%17 = sdiv i32 %13, %16
%18 = add nsw i32 %17, %15
%19 = add nuw nsw i32 %14, 1
%20 = call i32 @pow(i32 5, i32 %19)
%21 = load i32, i32* %2
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %12
23: ; preds = %12
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%25 = add nuw nsw i32 %9, 1
%26 = load i32, i32* %1
%27 = icmp slt i32 %25, %26
br i1 %27, label %8, label %28
28: ; preds = %23, %0
ret i32 0
}