Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main()
{
	int i, j;
	int n;
	int a[10004];
	int ans[50004];
	int sum;
	for (i = 0;; i++)
	{
		scanf("%d", &n);
		if (n == 0)
			break;
		for (j = 0; j < n; j++)
			scanf("%d", &a[j]);
		sum = 0;
		for (j = 0; j < n; j++)
			sum += a[j];
		ans[i] = 0;
		for (j = 0; j < n; j++)
			if (sum >= n * a[j])
				ans[i]++;
	}
	for (j = 0; j < i; j++)
		printf("%d\n", ans[j]);
	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-237568(%rsp), %r11
	.cfi_def_cfa 11, 237624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2536, %rsp
	.cfi_def_cfa_offset 240160
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 240088(%rsp)
	xorl	%eax, %eax
	leaq	40064(%rsp), %rax
	movl	$0, 20(%rsp)
	leaq	48(%rsp), %r12
	movq	%rax, 8(%rsp)
	movq	%rax, %rbx
	leaq	44(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L13:
	movq	24(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	movq	%r12, %r15
	movq	%r12, %r13
	movl	$0, %r14d
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	addq	$4, %r13
	cmpl	%r14d, %edx
	jg	.L7
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %esi
	cmpl	$2, %esi
	jbe	.L17
	movl	%edx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r12,%rax), %rcx
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L9
	movdqa	%xmm0, %xmm1
	movl	%edx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %dl
	je	.L10
.L8:
	movslq	%eax, %rdi
	addl	48(%rsp,%rdi,4), %ecx
	leal	1(%rax), %edi
	cmpl	%edi, %edx
	jle	.L10
	movslq	%edi, %rdi
	addl	$2, %eax
	addl	48(%rsp,%rdi,4), %ecx
	cmpl	%eax, %edx
	jle	.L10
	cltq
	addl	48(%rsp,%rax,4), %ecx
.L10:
	leaq	4(%r12), %rax
	movl	$0, (%rbx)
	leaq	(%rax,%rsi,4), %rdi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$4, %rax
.L12:
	movl	(%r15), %esi
	imull	%edx, %esi
	cmpl	%ecx, %esi
	jg	.L11
	addl	$1, (%rbx)
.L11:
	movq	%rax, %r15
	cmpq	%rdi, %rax
	jne	.L26
	addl	$1, 20(%rsp)
	addq	$4, %rbx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L2:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L6
	movl	20(%rsp), %eax
	movq	8(%rsp), %rbx
	leaq	.LC1(%rip), %rbp
	subl	$1, %eax
	addq	$4, %rbx
	leaq	(%rbx,%rax,4), %r12
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L27:
	addq	$4, %rbx
.L14:
	movq	8(%rsp), %rax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, 8(%rsp)
	cmpq	%r12, %rbx
	jne	.L27
.L6:
	movq	240088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$240104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	$0, (%rbx)
	addq	$4, %rbx
	addl	$1, 20(%rsp)
	jmp	.L13
.L17:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L8
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-237568(%rsp), %r11
	.cfi_def_cfa 11, 237624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2536, %rsp
	.cfi_def_cfa_offset 240160
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 240088(%rsp)
	xorl	%eax, %eax
	leaq	40064(%rsp), %rax
	movl	$0, 20(%rsp)
	leaq	48(%rsp), %r12
	movq	%rax, 8(%rsp)
	movq	%rax, %rbx
	leaq	44(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L13:
	movq	24(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	movq	%r12, %r15
	movq	%r12, %r13
	movl	$0, %r14d
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	addq	$4, %r13
	cmpl	%r14d, %edx
	jg	.L7
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %esi
	cmpl	$2, %esi
	jbe	.L17
	movl	%edx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r12,%rax), %rcx
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L9
	movdqa	%xmm0, %xmm1
	movl	%edx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %dl
	je	.L10
.L8:
	movslq	%eax, %rdi
	addl	48(%rsp,%rdi,4), %ecx
	leal	1(%rax), %edi
	cmpl	%edi, %edx
	jle	.L10
	movslq	%edi, %rdi
	addl	$2, %eax
	addl	48(%rsp,%rdi,4), %ecx
	cmpl	%eax, %edx
	jle	.L10
	cltq
	addl	48(%rsp,%rax,4), %ecx
.L10:
	leaq	4(%r12), %rax
	movl	$0, (%rbx)
	leaq	(%rax,%rsi,4), %rdi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$4, %rax
.L12:
	movl	(%r15), %esi
	imull	%edx, %esi
	cmpl	%ecx, %esi
	jg	.L11
	addl	$1, (%rbx)
.L11:
	movq	%rax, %r15
	cmpq	%rdi, %rax
	jne	.L26
	addl	$1, 20(%rsp)
	addq	$4, %rbx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L2:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L6
	movl	20(%rsp), %eax
	movq	8(%rsp), %rbx
	leaq	.LC1(%rip), %rbp
	subl	$1, %eax
	addq	$4, %rbx
	leaq	(%rbx,%rax,4), %r12
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L27:
	addq	$4, %rbx
.L14:
	movq	8(%rsp), %rax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, 8(%rsp)
	cmpq	%r12, %rbx
	jne	.L27
.L6:
	movq	240088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$240104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	$0, (%rbx)
	addq	$4, %rbx
	addl	$1, 20(%rsp)
	jmp	.L13
.L17:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L8
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
rule
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-237568(%rsp), %r11
	.cfi_def_cfa 11, 237624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2536, %rsp
	.cfi_def_cfa_offset 240160
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 240088(%rsp)
	xorl	%eax, %eax
	leaq	40064(%rsp), %rax
	movl	$0, 20(%rsp)
	leaq	48(%rsp), %r12
	movq	%rax, 8(%rsp)
	movq	%rax, %rbx
	leaq	44(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L13:
	movq	24(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	movq	%r12, %r15
	movq	%r12, %r13
	movl	$0, %r14d
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	addq	$4, %r13
	cmpl	%r14d, %edx
	jg	.L7
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %esi
	cmpl	$2, %esi
	jbe	.L17
	movl	%edx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r12,%rax), %rcx
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L9
	movdqa	%xmm0, %xmm1
	movl	%edx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %dl
	je	.L10
.L8:
	movslq	%eax, %rdi
	addl	48(%rsp,%rdi,4), %ecx
	leal	1(%rax), %edi
	cmpl	%edi, %edx
	jle	.L10
	movslq	%edi, %rdi
	addl	$2, %eax
	addl	48(%rsp,%rdi,4), %ecx
	cmpl	%eax, %edx
	jle	.L10
	cltq
	addl	48(%rsp,%rax,4), %ecx
.L10:
	leaq	4(%r12), %rax
	movl	$0, (%rbx)
	leaq	(%rax,%rsi,4), %rdi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$4, %rax
.L12:
	movl	(%r15), %esi
	imull	%edx, %esi
	cmpl	%ecx, %esi
	jg	.L11
	addl	$1, (%rbx)
.L11:
	movq	%rax, %r15
	cmpq	%rdi, %rax
	jne	.L26
	addl	$1, 20(%rsp)
	addq	$4, %rbx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L2:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L6
	movl	20(%rsp), %eax
	movq	8(%rsp), %rbx
	leaq	.LC1(%rip), %rbp
	subl	$1, %eax
	addq	$4, %rbx
	leaq	(%rbx,%rax,4), %r12
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L27:
	addq	$4, %rbx
.L14:
	movq	8(%rsp), %rax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, 8(%rsp)
	cmpq	%r12, %rbx
	jne	.L27
.L6:
	movq	240088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$240104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	$0, (%rbx)
	addq	$4, %rbx
	addl	$1, 20(%rsp)
	jmp	.L13
.L17:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L8
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
```c
#include<stdio.h>
int main()
{
	int i, j;
	int n;
	int a[10004];
	int ans[50004];
	int sum;
	for (i = 0;; i++)
	{
		scanf("%d", &n);
		if (n == 0)
			break;
		for (j = 0; j < n; j++)
			scanf("%d", &a[j]);
		sum = 0;
		for (j = 0; j < n; j++)
			sum += a[j];
		ans[i] = 0;
		for (j = 0; j < n; j++)
			if (sum >= n * a[j])
				ans[i]++;
	}
	for (j = 0; j < i; j++)
		printf("%d\n", ans[j]);
	return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main()
{
	int i, j;
	int n;
	int a[10004];
	int ans[50004];
	int sum;
	for (i = 0;; i++)
	{
		scanf("%d", &n);
		if (n == 0)
			break;
		for (j = 0; j < n; j++)
			scanf("%d", &a[j]);
		sum = 0;
		for (j = 0; j < n; j++)
			sum += a[j];
		ans[i] = 0;
		for (j = 0; j < n; j++)
			if (sum >= n * a[j])
				ans[i]++;
	}
	for (j = 0; j < i; j++)
		printf("%d\n", ans[j]);
	return 0;
}
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

7
15 15 15 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 8 4
0
 7
15 15 1 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
23 15 1 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
23 15 1 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
31 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
23 15 1 5 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
31 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
23 24 1 5 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
31 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
15 15 15 15 15 15 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
4 7 1 8 2 8 4
0
 7
15 15 1 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 11 8
0
 7
23 24 1 5 15 23 15
4
10 20 30 60
10
1 1 1 1 0 1 1 1 0 000
7
31 90 90 90 90 90 10
7
2 7 0 8 2 11 4
0
 7
15 15 15 15 15 23 15
4
10 20 30 60
10
1 2 1 0 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 11 7
0

6
3
9
1
4
 1
3
9
1
4
 5
3
9
1
4
 5
3
9
2
4
 2
3
9
2
4
 4
3
9
2
4
 7
3
9
1
4
 1
3
9
1
3
 4
3
3
2
4
 6
3
9
1
3

Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main()
{
	int i, j;
	int n;
	int a[10004];
	int ans[50004];
	int sum;
	for (i = 0;; i++)
	{
		scanf("%d", &n);
		if (n == 0)
			break;
		for (j = 0; j < n; j++)
			scanf("%d", &a[j]);
		sum = 0;
		for (j = 0; j < n; j++)
			sum += a[j];
		ans[i] = 0;
		for (j = 0; j < n; j++)
			if (sum >= n * a[j])
				ans[i]++;
	}
	for (j = 0; j < i; j++)
		printf("%d\n", ans[j]);
	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-237568(%rsp), %r11
	.cfi_def_cfa 11, 237624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2536, %rsp
	.cfi_def_cfa_offset 240160
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 240088(%rsp)
	xorl	%eax, %eax
	leaq	40064(%rsp), %rax
	movl	$0, 20(%rsp)
	leaq	48(%rsp), %r12
	movq	%rax, 8(%rsp)
	movq	%rax, %rbx
	leaq	44(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L13:
	movq	24(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	movq	%r12, %r15
	movq	%r12, %r13
	movl	$0, %r14d
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	addq	$4, %r13
	cmpl	%r14d, %edx
	jg	.L7
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %esi
	cmpl	$2, %esi
	jbe	.L17
	movl	%edx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r12,%rax), %rcx
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L9
	movdqa	%xmm0, %xmm1
	movl	%edx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %dl
	je	.L10
.L8:
	movslq	%eax, %rdi
	addl	48(%rsp,%rdi,4), %ecx
	leal	1(%rax), %edi
	cmpl	%edi, %edx
	jle	.L10
	movslq	%edi, %rdi
	addl	$2, %eax
	addl	48(%rsp,%rdi,4), %ecx
	cmpl	%eax, %edx
	jle	.L10
	cltq
	addl	48(%rsp,%rax,4), %ecx
.L10:
	leaq	4(%r12), %rax
	movl	$0, (%rbx)
	leaq	(%rax,%rsi,4), %rdi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$4, %rax
.L12:
	movl	(%r15), %esi
	imull	%edx, %esi
	cmpl	%ecx, %esi
	jg	.L11
	addl	$1, (%rbx)
.L11:
	movq	%rax, %r15
	cmpq	%rdi, %rax
	jne	.L26
	addl	$1, 20(%rsp)
	addq	$4, %rbx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L2:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L6
	movl	20(%rsp), %eax
	movq	8(%rsp), %rbx
	leaq	.LC1(%rip), %rbp
	subl	$1, %eax
	addq	$4, %rbx
	leaq	(%rbx,%rax,4), %r12
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L27:
	addq	$4, %rbx
.L14:
	movq	8(%rsp), %rax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, 8(%rsp)
	cmpq	%r12, %rbx
	jne	.L27
.L6:
	movq	240088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$240104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	$0, (%rbx)
	addq	$4, %rbx
	addl	$1, 20(%rsp)
	jmp	.L13
.L17:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L8
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-237568(%rsp), %r11
	.cfi_def_cfa 11, 237624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2536, %rsp
	.cfi_def_cfa_offset 240160
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 240088(%rsp)
	xorl	%eax, %eax
	leaq	40064(%rsp), %rax
	movl	$0, 20(%rsp)
	leaq	48(%rsp), %r12
	movq	%rax, 8(%rsp)
	movq	%rax, %rbx
	leaq	44(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L13:
	movq	24(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	movq	%r12, %r15
	movq	%r12, %r13
	movl	$0, %r14d
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	addq	$4, %r13
	cmpl	%r14d, %edx
	jg	.L7
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %esi
	cmpl	$2, %esi
	jbe	.L17
	movl	%edx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r12,%rax), %rcx
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L9
	movdqa	%xmm0, %xmm1
	movl	%edx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %dl
	je	.L10
.L8:
	movslq	%eax, %rdi
	addl	48(%rsp,%rdi,4), %ecx
	leal	1(%rax), %edi
	cmpl	%edi, %edx
	jle	.L10
	movslq	%edi, %rdi
	addl	$2, %eax
	addl	48(%rsp,%rdi,4), %ecx
	cmpl	%eax, %edx
	jle	.L10
	cltq
	addl	48(%rsp,%rax,4), %ecx
.L10:
	leaq	4(%r12), %rax
	movl	$0, (%rbx)
	leaq	(%rax,%rsi,4), %rdi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$4, %rax
.L12:
	movl	(%r15), %esi
	imull	%edx, %esi
	cmpl	%ecx, %esi
	jg	.L11
	addl	$1, (%rbx)
.L11:
	movq	%rax, %r15
	cmpq	%rdi, %rax
	jne	.L26
	addl	$1, 20(%rsp)
	addq	$4, %rbx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L2:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L6
	movl	20(%rsp), %eax
	movq	8(%rsp), %rbx
	leaq	.LC1(%rip), %rbp
	subl	$1, %eax
	addq	$4, %rbx
	leaq	(%rbx,%rax,4), %r12
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L27:
	addq	$4, %rbx
.L14:
	movq	8(%rsp), %rax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, 8(%rsp)
	cmpq	%r12, %rbx
	jne	.L27
.L6:
	movq	240088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$240104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	$0, (%rbx)
	addq	$4, %rbx
	addl	$1, 20(%rsp)
	jmp	.L13
.L17:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L8
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```