Polycarpus has an array, consisting of n integers a_1, a_2, ..., a_{n}. Polycarpus likes it when numbers in an array match. That's why he wants the array to have as many equal numbers as possible. For that Polycarpus performs the following operation multiple times:

  he chooses two elements of the array a_{i}, a_{j} (i ≠ j);  he simultaneously increases number a_{i} by 1 and decreases number a_{j} by 1, that is, executes a_{i} = a_{i} + 1 and a_{j} = a_{j} - 1. 

The given operation changes exactly two distinct array elements. Polycarpus can apply the described operation an infinite number of times. 

Now he wants to know what maximum number of equal array elements he can get if he performs an arbitrary number of such operation. Help Polycarpus.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 10^5) — the array size. The second line contains space-separated integers a_1, a_2, ..., a_{n} (|a_{i}| ≤ 10^4) — the original array.


-----Output-----

Print a single integer — the maximum number of equal array elements he can get if he performs an arbitrary number of the given operation.


-----Examples-----
Input
2
2 1

Output
1

Input
3
1 4 1

Output
3

Difficulty: EASY
Tags: Mathematics

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
n = int(input())
arr = [int(c) for c in input().split()]
if sum(arr) % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
a = [int(v) for v in input().split()]
if sum(a) % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
print(n - 1 if sum(map(int, input().split())) % n else n)


n = int(input())
nums = list(map(int, input().split()))
average = 0
for i in range(n):
	average += nums[i]
average /= n
if average == int(average):
	print(n)
else:
	print(n - 1)


n = int(input())
(a, *arr) = list(map(int, input().split()))
if (a + sum(arr)) % n:
	print(n - 1)
else:
	print(n)


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
ara = inara()
tot = 0
for num in ara:
	tot += num
tot //= n
baki = 0
for num in ara:
	if num >= tot:
		baki -= num - tot
	else:
		baki += tot - num
if baki != 0:
	print(n - 1)
else:
	print(n)


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
n = INT()
arr = LIST()
k = sum(arr) // n
mx = -1
ind = -1
for i in range(n):
	if abs(arr[i]) > mx:
		mx = abs(arr[i])
		ind = i
mx2 = arr[ind]
for i in range(n):
	if i == ind or arr[i] == k:
		continue
	else:
		while arr[i] < k:
			arr[i] += 1
			arr[ind] -= 1
		while arr[i] > k:
			arr[i] -= 1
			arr[ind] += 1
x = Counter(arr)
y = x.values()
z = max(y)
print(z)


n = int(input())
arr = list(map(int, input().split()))
sum1 = sum(arr)
res = n
if sum1 % n:
	res = n - 1
print(res)


n = int(input())
arr = list(map(int, input().split()))
x = sum(arr)
if x % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
a = list(map(int, input().split()))
ans = n - 1
if sum(a) % n == 0:
	ans = n
print(ans)


import sys
n = int(sys.stdin.readline())
ais = list(map(int, sys.stdin.readline().split()))
if sum(ais) % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
if sum([int(x) for x in input().split()]) % n == 0:
	print(n)
else:
	print(n - 1)


from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from decimal import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
M = 10 ** 9 + 7
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, m):
	a %= m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynum(x, l, r, a):
	if x >= l and x <= r:
		a.append(x)
	if x > r:
		a.append(x)
		return a
	if x < 10000000000.0:
		luckynum(x * 10 + 4, l, r, a)
		luckynum(x * 10 + 7, l, r, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def findTrailingZeros(n):
	count = 0
	while n >= 5:
		n //= 5
		count += n
	return count

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
res = set()

def solven(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solven(p * 10 + a, l + 1, a, b, n)
	solven(p * 10 + b, l + 1, a, b, n)

def subsetsUtil(A, subset, index, d):
	print(*subset)
	s = sum(subset)
	d.append(s)
	for i in range(index, len(A)):
		subset.append(A[i])
		subsetsUtil(A, subset, i + 1, d)
		subset.pop(-1)
	return d

def subsetSums(arr, l, r, d, sum=0):
	if l > r:
		d.append(sum)
		return
	subsetSums(arr, l + 1, r, d, sum + arr[l])
	subsetSums(arr, l + 1, r, d, sum)
	return d

def print_factors(x):
	factors = []
	for i in range(1, x + 1):
		if x % i == 0:
			factors.append(i)
	return factors

def calc(X, d, ans, D):
	if len(X) == 0:
		return
	i = X.index(max(X))
	ans[D[max(X)]] = d
	Y = X[:i]
	Z = X[i + 1:]
	calc(Y, d + 1, ans, D)
	calc(Z, d + 1, ans, D)

def factorization(n, l):
	c = n
	if prime(n) == True:
		l.append(n)
		return l
	for i in range(2, c):
		if n == 1:
			break
		while n % i == 0:
			l.append(i)
			n = n // i
	return l

def good(b):
	l = []
	i = 0
	while len(b) != 0:
		if b[i] < b[len(b) - 1 - i]:
			l.append(b[i])
			b.remove(b[i])
		else:
			l.append(b[len(b) - 1 - i])
			b.remove(b[len(b) - 1 - i])
	if l == sorted(l):
		return True
	return False

def generate(st, s):
	if len(s) == 0:
		return
	if s not in st:
		st.add(s)
		for i in range(len(s)):
			t = list(s).copy()
			t.remove(s[i])
			t = ''.join(t)
			generate(st, t)
	return

def largestincreasingsubsequence(A):
	l = [1] * len(A)
	sub = []
	for i in range(1, len(l)):
		for k in range(i):
			if A[k] < A[i]:
				sub.append(l[k])
		l[i] = 1 + max(sub, default=0)
	return max(l, default=0)

def findOR(nums, N):
	prefix_sum = 0
	result = 0
	for i in range(N):
		result |= nums[i]
		prefix_sum += nums[i]
		result |= prefix_sum
	return result

def OR(a, n):
	ans = a[0]
	for i in range(1, n):
		ans |= a[i]
	return ans

def main():
	n = inpu()
	arr = lis()
	if sum(arr) % n == 0:
		print(n)
	else:
		print(n - 1)
main()


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
average = sum(arr) // n
(low, high) = (0, n - 1)
while low < high:
	amount = min(abs(arr[low] - average), abs(arr[high] - average))
	arr[low] += amount
	arr[high] -= amount
	if arr[low] == average:
		low += 1
	if arr[high] == average:
		high -= 1
ans = sum((1 for x in arr if x == average))
print(ans)


n = int(input())
l = sum(list(map(int, input().split())))
print([n, n - 1][l % n != 0])


n = int(input())
m = list(map(int, input().split()))
if sum(m) // n * n == sum(m):
	print(n)
else:
	print(n - 1)


n = int(input())
a = [int(x) for x in input().split(' ')]
s = sum(a)
k = s % n
print(max(n - k, n - 1))


n = int(input())
arr = [int(x) for x in input().split(' ')]
if not sum(arr) % n:
	print(n)
else:
	print(n - 1)


n = int(input())
a = list(map(int, input().split()))
sum = 0
for i in range(n):
	sum += a[i]
print(n if sum % n == 0 else n - 1)


n = int(input())
array = list(map(int, input().split()))
s = 0
for i in range(n):
	s += array[i]
if s % n:
	print(n - 1)
else:
	print(n)


def strange_mas(lst):
	if sum(lst) % len(lst) == 0:
		return len(lst)
	return len(lst) - 1
n = int(input())
a = [int(i) for i in input().split()]
print(strange_mas(a))


n = int(input())
lis = list(map(int, input().split()))
d = c = lower = upper = 0
s = sum(lis) // n
for i in range(n - 1, -1, -1):
	if lis[i] > s:
		d += lis[i] - s
		upper += 1
	elif s > lis[i]:
		c += s - lis[i]
		lower += 1
if d == c:
	print(n)
else:
	print(n - 1)


n = int(input())
arr = list(map(int, input().split()))
print(n - (sum(arr) % n != 0))


n = int(input())
line = list(map(int, input().split()))
sum_list = sum(line)
if sum_list % n == 0:
	print(n)
else:
	print(n - 1)


def IC():
	n = int(input())
	a = [int(x) for x in input().split()]
	shave = sum(a)
	if shave % n == 0:
		print(n)
		return
	else:
		print(n - 1)
		return
IC()


n = int(input())
array = sum(list(map(int, input().split())))
if array % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
s = sum(list(map(int, input().split()))) + 228000 * n
print(max(n - s % n, n - 1))


n = int(input())
a = sum(map(int, input().split()))
print(n - 1 if a % n != 0 else n)


n = int(input())
arr = list(map(int, input().split()))
sum = 0
for x in arr:
	sum += x
result = n - 1
if sum % n == 0:
	result = n
print(result)


import sys
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n,) = I()
a = I()
fix = a[0]
for i in range(1, n):
	fix += a[i]
if fix % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
s = sum([int(i) for i in input().split()])
if s % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
lst = list(map(int, input().split()))
summ = sum(lst)
if summ % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
l = list(map(int, input().split()))
ans = 0
ma = max(l)
for i in range(n):
	ans += ma - l[i]
if ans % n == 0:
	print(n)
else:
	print(n - 1)


__autor__ = 'Esfandiar'
from math import ceil
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
if s % n == 0:
	print(n)
	exit()
print(n - 1)


a = int(input())
b = list(map(int, input().split()))
if sum(b) % a != 0:
	print(a - 1)
else:
	print(a)


input()
arr = list(map(int, input().strip().split()))
print(len(arr) if sum(arr) % len(arr) == 0 else len(arr) - 1)


n = int(input())
list = input().split()
sum = 0
for i in range(len(list)):
	sum += int(list[i])
if sum % n == 0:
	print(n)
else:
	print(n - 1)


class CodeforcesTask246BSolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.array = []

	def read_input(self):
		self.n = int(input())
		self.array = [int(x) for x in input().split(' ')]

	def process_task(self):
		s = sum(self.array)
		if not s % self.n:
			self.result = str(self.n)
		else:
			self.result = str(self.n - 1)

	def get_result(self):
		return self.result
Solution = CodeforcesTask246BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
num = map(int, input().split())
if sum(num) % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
array = [int(c) for c in input().split()]
array.sort()
avg = sum(array) // n
(low, hi) = (0, n - 1)
while low < hi:
	amount = min(abs(array[hi] - avg), abs(avg - array[low]))
	array[low] += amount
	array[hi] -= amount
	if array[low] == avg:
		low += 1
	if array[hi] == avg:
		hi -= 1
ans = sum((1 for x in array if x == avg))
print(ans)


n = int(input())
print(n - (sum(map(int, input().split())) % n != 0))


n = int(input())
arr = [int(i) for i in input().split()]
s = 0
for i in range(n):
	s += arr[i]
if s % n == 0:
	print(n)
else:
	print(n - 1)


from math import pi

def main():
	n = int(input())
	s = sum(map(int, input().split()))
	if s % n:
		n -= 1
	print(n)

def __starting_point():
	main()
__starting_point()


import sys
import math
n = int(sys.stdin.readline())
an = [int(x) for x in sys.stdin.readline().split()]
vsum = sum(an)
if vsum % n == 0:
	print(int(n))
else:
	print(int(n - 1))


x = int(input())
y = list(map(int, input().split(' ')))
tot = sum(y)
mod = tot % x
if mod == 0:
	print(x)
else:
	print(x - 1)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
n = iinput()
a = list(map(int, input().split()))
if sum(a) % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
s = sum(map(int, input().split()))
print(n if s % n == 0 else n - 1)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	n = I()
	arr = L()
	if sum(arr) % n == 0:
		print(n)
	else:
		print(n - 1)
main()


n = int(input())
l = list(map(int, input().split()))
ml = min(l)
if ml < 0:
	d = 0 - ml
	l = [i + d for i in l]
ls = sum(l)
if ls % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
a = list(map(int, input().split()))
suma = sum(a)
print(max(n - 1, n - suma % n))


import statistics
n = int(input())
a = list(map(int, input().rstrip().split()))
s = sum(a)
if s % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
l = list(map(int, input().split()))
sum = 0
for i in l:
	sum += i
if sum % n == 0:
	print(n)
else:
	print(n - 1)


from math import *

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	print(n if sum(arr) / len(arr) % 1 == 0 else n - 1)
main()


for _ in range(1):
	n = int(input())
	array = [int(i) for i in input().split()]
	if sum(array) % n:
		print(n - 1)
	else:
		print(n)


n = int(input())
a = [int(i) for i in input().split()]
total = 0
res = n
for i in a:
	total += i
if total % n:
	res = n - 1
print(res)


n = int(input())
ss = sum(map(int, input().split()))
print(n if ss % n == 0 else n - 1)


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def main():
	n = int(input())
	a = list(map(int, input().split()))
	print(n if sum(a) % n == 0 else n - 1)
main()


from sys import stdin
n = int(stdin.readline())
nums = list(map(int, stdin.readline().split()))
if sum(nums) % n == 0:
	print(n)
else:
	print(n - 1)


def solve(l):
	n = len(l)
	if not sum(l) % n:
		print(n)
	else:
		print(n - 1)
N = int(input())
l = list(map(int, input().split()))
ans = solve(l)


n = int(input())
li = [int(x) for x in input().split()]
s = sum(li)
x = s // n
if x * n == s:
	print(n)
else:
	print(n - 1)


n = input()
mas = input()
mas = mas.split(' ', int(len(mas) + 1 / 2))
mas = list(map(int, mas))
k = sum(mas) / len(mas)
if k % 1 == 0:
	print(len(mas))
else:
	print(len(mas) - 1)


import math
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
su = sum(a)
if su % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
nums = list(map(int, input().split(' ')))
average = int(sum(nums) / len(nums))
if average - sum(nums) / len(nums) == 0:
	print(len(nums))
else:
	print(len(nums) - 1)


import math
n = int(input())
lst = list(map(int, input().strip().split(' ')))
s = sum(lst)
if s % n == 0:
	print(n)
else:
	print(n - 1)


a = int(input())
t = list(map(int, input().split()))
u = sum(t)
if u % a == 0:
	print(a)
else:
	print(a - 1)


def maxEquals(arr, num):
	(even, odd) = (0, 0)
	avg = sum(arr) / num
	if round(avg, 4) == int(avg):
		print(num)
		return
	print(num - 1)
num = int(input())
arr = [int(x) for x in input().split()]
maxEquals(arr, num)


n = int(input())
a = list(map(int, input().split()))
x = min(a)
a = [i + abs(x) for i in a]
s = sum(a)
r = s % n
if r == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
l = [int(x) for x in input().split(' ')]
s = 0
for i in l:
	s += i
if s % n == 0:
	print(n)
else:
	print(n - 1)


from collections import defaultdict
from math import floor
n = int(input())
arr1 = list(map(int, input().split()))
s = sum(arr1)
mul = int(floor(s / n))
res = 0
if mul * n == s:
	res = n
else:
	res = n - 1
print(res)


import sys, os, io, time, copy, math
from functools import lru_cache
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	s = sum(arr)
	avg = s / n
	if int(avg) == avg:
		print(n)
	else:
		print(n - 1)
main()


x = int(input(''))
y = str(input('')).split()
sum = 0
for a in range(x):
	sum = sum + int(y[a])
if sum % x == 0:
	print(x)
else:
	print(x - 1)


def main():
	N = int(input())
	arr = list(map(int, input().split()))
	add = sum(arr)
	if add % N == 0:
		print(N)
	else:
		print(N - 1)
main()


n = int(input())
a = sorted(list(map(int, input().split(' '))))
s = sum(a)
if s % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
ara = list(map(int, input().split()))
sum = 0
for i in range(n):
	sum += ara[i]
p = int(sum / n)
print(n - 1 if p * n != sum else n)


def func(arr):
	result_sum = 0
	for i in arr:
		result_sum += i
	if result_sum % len(arr) == 0:
		print(len(arr))
	else:
		print(len(arr) - 1)
k = int(input())
array = list(map(int, input().split()))
func(array)


def arr_inp():
	return [int(x) for x in stdin.readline().split()]
from sys import *
(n, s) = (int(input()), sum(arr_inp()))
print(n - 1 if s % n else n)


def gint():
	return int(input())

def gint_arr():
	return list(map(int, input().split()))

def gfloat():
	return float(input())

def gfloat_arr():
	return list(map(float, input().split()))

def pair_int():
	return map(int, input().split())
INF = 1 << 31
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
n = gint()
a = gint_arr()
print(n if sum(a) % n == 0 else n - 1)


a = int(input())
l = list(map(int, input().split()))
s = sum(l)
if s % a == 0:
	print(a)
else:
	print(a - 1)


x = int(input())
sm = sum(list(map(int, input().split()))) % x
if sm == 0:
	print(x)
else:
	print(x - 1)


n = int(input())
arr = list(map(int, input().split()))
if n == 1:
	print(0)
elif n == 2:
	if abs(arr[0] - arr[1]) % 2 == 0:
		print(2)
	else:
		print(1)
else:
	d = max(arr)
	for i in range(n - 1):
		arr[n - 1] -= d - arr[i]
	if (d - arr[n - 1]) % n == 0:
		print(n)
	else:
		print(n - 1)


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
n = INT()
arr = LIST()
if sum(arr) % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
arr = [int(i) for i in input().split()]
sum_ = sum(arr)
print(len(arr) - int(sum_ % len(arr) != 0))


n = int(input())
a = list(map(int, input().split()))
total = 0
ans = 0
for i in range(len(a)):
	total += a[i]
if total % n == 0:
	ans = n
else:
	ans = n - 1
print(ans)


def process(n, nums, mean):
	(g, l, ans) = ([], [], 0)
	for num in nums:
		if num > mean:
			g.append(num)
		elif num < mean:
			l.append(num)
		else:
			ans += 1
	while l and g:
		(se, ge) = (l.pop(), g.pop())
		if mean - se > ge - mean:
			se += ge - mean
			ge = mean
			ans += 1
			l.append(se)
		elif mean - se < ge - mean:
			ge -= mean - se
			se = mean
			ans += 1
			g.append(ge)
		else:
			ans += 2
	if not g:
		return ans
	else:
		ans += len(g) - 1
		return ans
from sys import stdin
n = int(stdin.readline())
nums = list(map(int, stdin.readline().split()))
if sum(nums) // n == sum(nums) / n:
	print(process(n, nums, sum(nums) / n))
elif sum(nums) / n > 0:
	a = process(n, nums, sum(nums) // n)
	b = process(n, nums, 1 + sum(nums) // n)
	print(a if a > b else b)
else:
	a = process(n, nums, sum(nums) // n)
	b = process(n, nums, 1 + sum(nums) // n)
	c = process(n, nums, -1 + sum(nums) // n)
	print(max(a, b, c))


def solution():
	n = int(input())
	arr = list(map(int, input().split()))
	if sum(arr) % n:
		print(n - 1)
	else:
		print(n)
	return
solution()


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
testcases = 1
for _ in range(testcases):
	n = vary(1)
	num = array_int()
	if sum(num) % n == 0:
		print(n)
	else:
		print(n - 1)


a = int(input())
b = [int(i) for i in input().split()]
c = sum(b)
if c % a == 0:
	print(a)
else:
	print(a - 1)


n = int(input())
arr = [int(x) for x in input().split()]
k = sum(arr) % n
print(max(n - k, n - 1))


n = int(input())
A = list(map(int, input().split()))
x = 0
for i in A:
	x += i
if not x % n:
	print(n)
else:
	print(n - 1)


n = int(input())
A = list(map(int, input().split()))
S = sum(A)
if S % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
arr = list(map(int, input().split()))
x = sum(arr) % n
print(max([n - 1, x, n - x]))


n = int(input())
a = list(map(int, input().split()))
sum1 = 0
for i in a:
	sum1 += i
x = sum1 // n
if sum1 % n == 0:
	print(n)
else:
	print(n - 1)


from functools import reduce
from collections import Counter
import time
import datetime

def time_t():
	print('Current date and time: ', datetime.datetime.now())
	print('Current year: ', datetime.date.today().strftime('%Y'))
	print('Month of year: ', datetime.date.today().strftime('%B'))
	print('Week number of the year: ', datetime.date.today().strftime('%W'))
	print('Weekday of the week: ', datetime.date.today().strftime('%w'))
	print('Day of year: ', datetime.date.today().strftime('%j'))
	print('Day of the month : ', datetime.date.today().strftime('%d'))
	print('Day of week: ', datetime.date.today().strftime('%A'))

def ip():
	return int(input())

def sip():
	return input()

def mip():
	return map(int, input().split())

def mips():
	return map(str, input().split())

def lip():
	return list(map(int, input().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)
t = ip()
arr = lip()
if sum(arr) % t:
	print(t - 1)
else:
	print(t)


def fun(x, l):
	if len(set(x)) == 1:
		print(l)
		return
	if sum(x) % l == 0:
		print(l)
	else:
		print(l - 1)
	return
l = int(input())
x = list(map(int, input().split()))
x.sort()
fun(x, l)


a = int(input())
b = sum(map(int, input().split()))
print(a - 1 if b % a else a)


import traceback
import math
from collections import defaultdict
from functools import lru_cache
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def geti():
	return int(input())

def gets():
	return input()

def getil():
	return list(map(int, input().split()))

def getsl():
	return input().split()

def get2d(nrows, ncols, n=0):
	return [[n] * ncols for r in range(nrows)]
inf = float('inf')
mod = 10 ** 9 + 7

def main():
	N = geti()
	a = getil()
	return N - 1 if sum(a) % N != 0 else N
try:
	ans = main()
	print(ans)
except Exception as e:
	traceback.print_exc()


n = int(input())
arr = input().split()
arr = [int(i) for i in arr]
sum_arr = sum(arr)
ans = n
if sum_arr % n:
	ans = n - 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
if s % n == 0:
	print(n)
else:
	print(max(1, n - 1))


import collections
n = int(input())
A = [int(x) for x in input().split()]
A.sort()
p = sum(A[:-1])
A[-1] += p
x = A[-1] / n
if x == int(x):
	print(n)
else:
	print(n - 1)


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
n = int(input())
a = list(map(int, input().split()))
asum = sum(a)
if asum % n:
	print(n - 1)
else:
	print(n)


def main():
	from sys import stdin, stdout
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	arrsum = sum(arr)
	if arrsum % n == 0:
		stdout.write(str(n) + '\n')
	else:
		stdout.write(str(n - 1) + '\n')
main()


n = int(input())
x = list(map(int, input().split()))
x.sort()
y = sorted(x)
v1 = sum(x) // n
v2 = v1 + 1
i = 0
while i < n - 1:
	x[i + 1] -= v1 - x[i]
	x[i] += v1 - x[i]
	i += 1
i = 0
while i < n - 1:
	y[i + 1] -= v2 - y[i]
	y[i] += v2 - y[i]
	i += 1
print(max(x.count(x[0]), y.count(y[0])))


import math
n = int(input())
ans = 0
for x in input().split():
	ans += int(x)
if n == 1:
	ans = 1
elif ans == int(ans / n) * n:
	ans = n
else:
	ans = n - 1
print(ans)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	a = list(map(int, input().split()))
	x = sum(a)
	if x % n == 0:
		print(n)
	else:
		print(n - 1)

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


n = int(input())
l = list(map(int, input().split()))
z = sum(l)
if z % n == 0:
	print(n)
else:
	print(n - 1)


n = int(input())
lst = map(int, input().split())
anes = sum(lst)
if anes % n:
	n -= 1
print(n)


n = int(input(''))
array = input('').split()
value = 0
for i in array:
	value = value + int(i)
actual = value % n
if actual == 0:
	print(n)
else:
	print(n - 1)


import sys, math, itertools, random, bisect
from collections import defaultdict
INF = sys.maxsize

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 10 ** 9 + 7
for _ in range(1):
	n = int(input())
	a = get_array()
	if sum(a) % n == 0:
		print(n)
	else:
		print(n - 1)


I = input
n = int(I())
if sum(map(int, I().split())) % n:
	n -= 1
print(n)