Given an array arr[] of N values, the task is to find the number which has the maximum number of zeroes. If there are no zeroes then print -1.
Note: If there are multiple numbers with the same (max) number of zeroes then print the Maximum number among them.
Example 1:
Input: N = 5
arr[] = {10, 20, 3000, 9999, 200}
Output:  3000
Explanation: 3000 contains 3 zero's 
in it.
Example 2:
Input: N = 4
arr[] = {1, 2, 3, 4}
Output:  -1
Explanation: No zero is present.
 
Your Task:
This is a function problem. You don't need to take any input, as it is already accomplished by the driver code. You just need to complete the function MaxZero() that takes array arr[] and integer N as parameters and returns the number with the maximum number of zeroes.
 
Expected Time Complexity: O(N*M). where N is the size of array and M is the maximum length of a number in the array
Expected Auxiliary Space: O(1).
 
Constraints:
1 ≤ N ≤ 10^{5}
1 < A[i] < 10^{100}

Source: geeksforgeeks | Difficulty: EASY
Tags: Data structures

Starter code: # User Template code

def MaxZero(arr, n):
    # Your code goes here

Solutions:
def MaxZero(arr, n):
	m = '-1'
	c = -1
	for j in arr:
		i = str(j)
		if i.count('0') > c:
			c = i.count('0')
			m = i
		if i.count('0') == c:
			if int(m) < int(i):
				m = i
	if c == 0:
		return -1
	return m


def MaxZero(arr, n):
	max_zero_value = -1
	max_value = -1
	for x in arr:
		no_of_zeros = 0
		n1 = x
		while x > 0:
			if int(x % 10) == 0:
				no_of_zeros += 1
			x = int(x // 10)
		if no_of_zeros == 0:
			continue
		if no_of_zeros > max_zero_value:
			max_zero_value = no_of_zeros
			max_value = n1
		elif no_of_zeros == max_zero_value and n1 > max_value:
			max_value = n1
	return max_value


def MaxZero(arr, n):
	max_zero_num = 1
	for elem in arr:
		max_zero = str(max_zero_num).count('0')
		elem_zero = str(elem).count('0')
		if elem_zero == 0:
			continue
		elif elem_zero > max_zero:
			max_zero_num = elem
		elif elem_zero == max_zero:
			max_zero_num = elem if int(elem) > int(max_zero_num) else max_zero_num
	return -1 if max_zero_num == 1 else max_zero_num


def MaxZero(arr, n):
	zero_count = 0
	ans = -1
	for i in arr:
		x = str(i)
		dummy_count = x.count('0')
		if dummy_count > zero_count:
			ans = i
			zero_count = dummy_count
		elif dummy_count == zero_count:
			ans = max(i, ans)
	return -1 if zero_count == 0 else ans


def MaxZero(arr, n):
	num = -1
	m = 0
	for i in arr:
		c = 0
		temp = i
		while i:
			if i % 10 == 0:
				c += 1
			i //= 10
		if c > m:
			m = c
			num = temp
		elif c != 0 and c == m:
			num = max(num, temp)
	return num


def MaxZero(arr, n):
	count = -1
	mx = -1
	ans = 0
	for i in range(n):
		arr[i] = str(arr[i])
		count = 0
		for j in arr[i]:
			if int(j) == 0:
				count += 1
		if count > mx:
			mx = count
			ans = int(arr[i])
		elif count == mx:
			arr[i] = int(arr[i])
			if arr[i] > int(ans):
				ans = arr[i]
	if mx == 0:
		return -1
	return ans


def MaxZero(arr, n):
	max_zero = 0
	max_number = -1
	for number in arr:
		zero = 0
		number_str = str(number)
		for s in number_str:
			if s == '0':
				zero += 1
		if zero != 0 and zero > max_zero:
			max_number = number
			max_zero = zero
		if zero != 0 and zero == max_zero and (number > max_number):
			max_number = number
	if not max_zero:
		return -1
	return max_number


def MaxZero(arr, n):
	mx = 0
	k = -1
	for i in arr:
		s = str(i)
		c = s.count('0')
		if c >= mx:
			if c == mx and c != 0:
				if i > k:
					k = i
			if c > mx:
				mx = c
				k = i
	return k


def countzeroes(number):
	count = 0
	while number > 0:
		rem = number % 10
		if rem == 0:
			count += 1
		number = number // 10
	return count

def MaxZero(arr, n):
	res = []
	for i in range(n):
		zero_count = countzeroes(arr[i])
		res.append(zero_count)
	d = {}
	for i in range(n):
		d[arr[i]] = res[i]
	max_val = -1
	for (i, j) in d.items():
		max_val = max(max_val, j)
	ans = []
	for (i, j) in d.items():
		if d[i] == max_val and max_val != 0:
			ans.append(i)
	if len(ans) > 0:
		return max(ans)
	return -1


def MaxZero(arr, n):
	ans = -1
	res = -1
	for i in arr:
		t = 0
		s = str(i)
		if '0' in s:
			for j in s:
				if j == '0':
					t += 1
			if t > ans:
				ans = max(ans, t)
				res = int(s)
			elif t == ans:
				res = max(res, int(s))
	return res


def MaxZero(arr, n):
	arr.sort()
	lst = []
	lst2 = []
	s = ''
	for i in arr:
		s = str(i)
		lst.append(s.count('0'))
	a = max(lst)
	for i in arr:
		if a == str(i).count('0'):
			lst2.append(i)
	if sum(lst) == 0:
		return -1
	return max(lst2)


def MaxZero(arr, n):
	lst = []
	s = ''
	ans = -1
	cnt = 0
	for i in range(n):
		s = str(arr[i])
		lst.append(s.count('0'))
	if sum(lst) == 0:
		return -1
	a = max(lst)
	lst2 = []
	j = lst.index(a)
	for i in range(len(lst)):
		if a == lst[i]:
			cnt += 1
			lst2.append(arr[i])
	if cnt == 1:
		return arr[j]
	lst2.sort()
	return lst2[-1]


def MaxZero(arr, n):
	max_num = -1
	max_zeroes_count = -1
	for num in arr:
		max_zeroes = count_zeroes(num)
		if max_zeroes > max_zeroes_count and max_zeroes > 0:
			max_zeroes_count = max_zeroes
			max_num = num
		elif max_zeroes == max_zeroes_count and num > max_num:
			max_num = num
	return max_num

def count_zeroes(num):
	count = 0
	while num:
		if num % 10 == 0:
			count += 1
		num //= 10
	return count


def MaxZero(arr, n):
	m = 0
	f = 0
	w = ''
	for i in range(0, len(arr)):
		num = arr[i]
		st = str(num)
		list1 = list(st)
		c = list1.count('0')
		if f == 0:
			m = c
			f = 1
			w = st
			current = int(w)
		elif c > m:
			m = c
			w = st
			current = int(w)
		elif c == m:
			if int(st) > current:
				w = st
				current = int(st)
	if '0' not in w:
		return -1
	return w


def MaxZero(arr, n):
	count = 0
	max_num = -1
	for i in arr:
		num = 0
		for j in str(i):
			if j == '0':
				num = num + 1
		if num > count:
			count = num
			max_num = i
		elif num == count:
			if i > max_num:
				max_num = i
				count = num
	if count == 0:
		return -1
	return max_num


def MaxZero(arr, n):
	arr = list(map(str, arr))
	d = dict()
	ans = 0
	for i in arr:
		if i not in d:
			d[i] = i.count('0')
	maxd = max(d.values())
	if maxd == 0:
		return -1
	for i in d:
		if d[i] == maxd:
			ans = max(ans, int(i))
	return ans


def MaxZero(arr, n):
	ans = -1
	m = 0
	for i in range(n):
		temp = str(arr[i])
		count = temp.count('0')
		if m < count:
			ans = arr[i]
			m = count
		if count == m and arr[i] > ans:
			ans = arr[i]
	if m == 0:
		return -1
	return ans


def MaxZero(arr, n):
	c = 0
	new = 0
	for i in range(n):
		if str(arr[i]).count('0') > c:
			c = str(arr[i]).count('0')
			new = arr[i]
		elif str(arr[i]).count('0') == c:
			if arr[i] > new:
				new = arr[i]
	if c == 0:
		return -1
	return new


def MaxZero(arr, n):
	arr.sort(reverse=True)
	(ans, num) = (0, -1)
	for i in arr:
		temp = str(i).count('0')
		if temp > ans and temp != 0:
			num = i
		ans = max(ans, temp)
	return num


def zero(num):
	a = str(num)
	c = 0
	for i in a:
		if i == '0':
			c += 1
	return c

def MaxZero(arr, n):
	res = {}
	maxi = 0
	idx = 0
	for i in range(n):
		n = zero(arr[i])
		if n > maxi:
			maxi = max(maxi, n)
			idx = i
			res[arr[idx]] = maxi
		elif n == maxi:
			res[arr[i]] = maxi
	result = -1
	k = 0
	for (i, j) in res.items():
		if j > k:
			k = j
			result = i
		elif k == j and j != 0:
			result = max(result, i)
	return result


def MaxZero(arr, n):
	cnt = 0
	l = []
	for i in arr:
		ii = str(i)
		iii = ii.count('0')
		if iii >= cnt:
			cnt = iii
			l.append(i)
	if cnt == 0:
		return -1
	else:
		ll = []
		for i in l:
			if str(i).count('0') == cnt:
				ll.append(i)
		return max(ll)


def MaxZero(arr, n):
	result = -1
	count = 0
	arr.sort(reverse=True)
	for item in arr:
		temp = str(item).count('0')
		if temp > count:
			result = item
			count = temp
	return result


def MaxZero(arr, n):
	a = 0
	c = 0
	for x in arr:
		b = str(x).count('0')
		if b > a:
			a = b
			c = int(x)
		elif b > 0 and b == a:
			c = max(int(x), c)
	if not c:
		return -1
	return c


def MaxZero(arr, n):
	max_zeros = -1
	max_z_ele = -1
	for i in range(n):
		t = str(arr[i])
		c = t.count('0')
		if c == max_zeros and c != 0:
			max_z_ele = max(max_z_ele, int(t))
			max_zeros = c
		elif c > max_zeros and c != 0:
			max_z_ele = int(t)
			max_zeros = c
	return max_z_ele


def MaxZero(arr, n):
	p = 0
	k = 0
	u = 0
	for i in range(n):
		g = str(arr[i])
		m = g.count('0')
		if k < m:
			k = max(k, m)
			u = arr[i]
		if k == m:
			u = max(u, arr[i])
	if k == 0:
		return -1
	return u


def MaxZero(a, n):
	a.sort()
	maxx = 0
	var = 0
	for i in range(n - 1, -1, -1):
		x = str(a[i])
		count = x.count('0')
		if count > maxx:
			maxx = max(count, maxx)
			var = a[i]
	if var:
		return var
	else:
		return -1


def MaxZero(arr: list, n: int) -> int:
	import math
	maximum = float('-inf')
	max_count = 0
	for i in range(n):
		zeros_count = counter2(arr[i])
		if zeros_count:
			if zeros_count > max_count:
				max_count = zeros_count
				maximum = arr[i]
			elif zeros_count == max_count:
				maximum = maximum if maximum > arr[i] else arr[i]
	if math.isinf(maximum):
		return -1
	else:
		return maximum

def counter1(num: int) -> int:
	count = 0
	for x in str(num):
		if x == '0':
			count += 1
	return count

def counter2(num: int) -> int:
	count = 0
	while num:
		digit = num % 10
		if not digit:
			count += 1
		num //= 10
	return count


def MaxZero(arr, n):
	arr.sort(reverse=True)
	res = -1
	outp = -1
	for i in arr:
		ans = str(i).count('0')
		if ans > res and ans != 0:
			res = ans
			outp = i
	return outp


def MaxZero(arr, n):
	mxNum = -1
	mxZero = 0
	for i in range(n):
		num = arr[i]
		zero = 0
		while num > 0:
			rem = num % 10
			if rem == 0:
				zero += 1
			num //= 10
		if zero != 0 and zero == mxZero:
			mxNum = max(mxNum, arr[i])
		elif zero != 0 and zero > mxZero:
			mxZero = zero
			mxNum = arr[i]
	return mxNum


def MaxZero(arr, n):
	maxi = -1
	dict1 = {}
	for i in arr:
		count = 0
		for element in str(i):
			if element == '0':
				count += 1
		maxi = max(maxi, count)
		dict1[i] = count
	result = []
	for key in dict1:
		if dict1[key] == maxi and dict1[key] != 0:
			result.append(key)
	if len(result) >= 1:
		return max(result)
	else:
		return -1


def MaxZero(arr, n):
	arr.sort()
	d = {}
	arr = list(map(str, arr))
	for i in arr:
		d.update({i.count('0'): i})
	if max(d) == 0:
		return -1
	return d[max(d)]


def MaxZero(arr, n):
	prev_count = 0
	ans = -1
	for item in arr:
		count = 0
		x = item
		for i in str(item):
			if i == '0':
				count += 1
		if count >= prev_count and count > 0:
			if count == prev_count:
				if x > ans:
					ans = x
			else:
				ans = x
			prev_count = count
	return ans


def MaxZero(arr, n):
	arr.sort()
	count = 0
	res = -1
	y = -1
	for i in range(n):
		x = len(str(arr[i]))
		e = arr[i]
		temp = 0
		while e > 0:
			if e % 10 == 0:
				temp += 1
				if temp >= count:
					count = temp
					res = i
			e = e // 10
	if count == 0:
		return -1
	y = arr[res]
	return y


def MaxZero(arr, n):
	max_at = max_count = 0
	for i in range(n):
		str_count = str(arr[i]).count('0')
		if str_count > max_count:
			max_at = i
			max_count = str(arr[i]).count('0')
		if str_count == max_count:
			if arr[i] > arr[max_at]:
				max_at = i
	return arr[max_at] if max_count else -1


def MaxZero(arr, n):
	res = 0
	ans = -1
	for i in arr:
		c = 0
		v = i
		while v:
			if v % 10 == 0:
				c += 1
			v = v // 10
		if c == 0:
			continue
		if c > res:
			ans = i
			res = c
		elif c == res:
			if i > ans:
				ans = i
	return ans


def MaxZero(arr, n):
	val = 0
	zero = 0
	for i in range(n):
		strr = str(arr[i])
		count = 0
		for j in strr:
			if j == '0':
				count += 1
		if zero < count:
			zero = count
			val = arr[i]
		elif zero == count:
			val = max(val, arr[i])
	if zero == 0:
		return -1
	return val


def MaxZero(arr, n):
	g = -1
	m = -1
	for i in arr:
		if '0' in i:
			h = i.count('0')
			if h == m:
				e = int(i)
				if e > g:
					g = e
			if h > m:
				m = h
				g = int(i)
	return g


def MaxZero(arr, n):
	h = {}
	for i in arr:
		if '0' in str(i):
			k = list(str(i)).count('0')
			h[int(i)] = k
	if h:
		res = sorted(h.items(), key=lambda x: (x[1], x[0]), reverse=True)
		return res[0][0]
	return -1


def MaxZero(arr, n):
	d = {}
	for i in arr:
		d[i] = str(i).count('0')
	val = sorted(d.items(), key=lambda x: x[1], reverse=True)
	temp = val[0][1]
	ans = []
	for i in val:
		if i[1] == temp:
			ans.append(i)
		else:
			break
	ans.sort(reverse=True)
	if ans[0][1] == 0:
		return -1
	else:
		return ans[0][0]


def getZero(num):
	count = 0
	s = str(num)
	for i in s:
		if i == '0':
			count += 1
	return count

def MaxZero(arr, n):
	d = {}
	for i in arr:
		if i not in d:
			d[i] = getZero(i)
	lst = sorted(d.items(), reverse=True)
	lst = sorted(lst, key=lambda x: x[1], reverse=True)
	for (key, val) in lst:
		if val != 0:
			return key
	return -1


def MaxZero(arr, n):
	res = -1
	zero = 0
	arr.sort()
	for num in arr:
		temp = 0
		for s in str(num):
			if s == '0':
				temp += 1
		if temp > 0 and temp >= zero:
			zero = temp
			res = num
	return res


def MaxZero(arr, n):
	count = 0
	zero = -1
	temp = '-1'
	arr.sort()
	for i in range(n):
		s = str(arr[i])
		count = s.count('0')
		if count > 0 and count >= zero:
			zero = count
			temp = s
	return temp


def MaxZero(arr, n):
	c = 0
	ans = 0
	for i in arr:
		i = str(i)
		a = i.count('0')
		i = int(i)
		if a == c:
			if i > ans:
				ans = i
		elif a > c:
			ans = i
			c = a
	if c == 0:
		return -1
	return ans


def MaxZero(arr, n):
	m = 0
	res = -1
	for x in arr:
		y = str(x)
		if y.count('0') > m:
			m = y.count('0')
			res = x
		elif y.count('0') > 0 and y.count('0') == m:
			res = max(res, x)
	return res


def MaxZero(arr, n):
	ans = 0
	result = -1
	for i in arr:
		r = list(str(i))
		if r.count('0') > ans:
			ans = r.count('0')
			result = i
		if r.count('0') == ans and i > result:
			if r.count('0') == 0:
				continue
			result = i
	return result


def MaxZero(arr, n):
	c = 0
	max = 0
	ret = -1
	for i in arr:
		c = 0
		for j in str(i):
			if j == '0':
				c += 1
		if c > max or ret == -1 or (ret >= 0 and c > 0 and (c == max) and (i > ret)):
			ret = i
			max = c
		else:
			pass
	if ret != -1 and max != 0:
		return ret
	else:
		return '-1'


def seg(a):
	arr = []
	while a > 0:
		res = a % 10
		arr.append(res)
		a = a // 10
	return arr

def MaxZero(arr, n):
	arr.sort()
	res = float('-inf')
	v2 = -1
	for i in range(n):
		ans = seg(arr[i])
		co = 0
		for j in range(len(ans)):
			if ans[j] == 0:
				co = co + 1
		if co >= res:
			res = max(res, co)
			val = arr[i]
			v2 = max(v2, val)
	if res == 0:
		return -1
	else:
		return v2
if __name__ == '__main__':
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		a = list(map(int, input().split()))
		print(MaxZero(a, n))


def MaxZero(arr, n):
	max_zero_count = 0
	max_zero_num = -1
	for num in arr:
		temp = num
		zero_count = 0
		while temp > 0:
			if temp % 10 == 0:
				zero_count += 1
			temp = temp // 10
		if zero_count > 0:
			if zero_count > max_zero_count:
				max_zero_count = zero_count
				max_zero_num = num
			elif zero_count == max_zero_count and num > max_zero_num:
				max_zero_num = num
	return max_zero_num
if __name__ == '__main__':
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		a = list(map(int, input().split()))
		print(MaxZero(a, n))


def MaxZero(arr, n):
	zeros = []
	for num in arr:
		zeros.append([str(num).count('0'), num])
	zeros.sort()
	if zeros[-1][0] > 0:
		return zeros[-1][1]
	return -1
if __name__ == '__main__':
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		a = list(map(int, input().split()))
		print(MaxZero(a, n))


def MaxZero(a, n):
	a.sort()
	l = []
	k = 0
	for i in range(n):
		t = str(a[i])[::-1]
		for j in range(len(str(t))):
			if t[j] == '0':
				k += 1
		l.append([k, a[i]])
		k = 0
	l.sort(key=lambda x: x[0])
	return l[-1][1] if l[-1][0] else -1


def MaxZero(arr, n):
	dict = {}
	for item in arr:
		dict[item] = str(item).count('0')
	max_count = max(dict.values())
	if max_count == 0:
		return -1
	values = []
	for (k, v) in dict.items():
		if v == max_count:
			values.append(k)
	return max(values)


def MaxZero(arr, n):
	dct = {}
	for i in arr:
		c = 0
		if i not in dct:
			for j in str(i):
				if j == '0':
					c += 1
			dct[i] = c
	mx_z = max(dct.values())
	if mx_z == 0:
		return -1
	mx_n = 0
	for (k, v) in dct.items():
		if v == mx_z:
			if mx_n <= k:
				mx_n = k
	return mx_n


def get_zeros(n):
	c = 0
	while n > 0:
		if n % 10 == 0:
			c += 1
		n = n // 10
	if c == 0:
		return -1
	return c

def MaxZero(arr, n):
	mz = -1
	m = 0
	for i in arr:
		a = get_zeros(i)
		if a >= mz:
			if a == mz:
				if m < i:
					m = i
			else:
				mz = a
				m = i
	if mz == -1:
		return -1
	return m


def MaxZero(arr, n):
	arr.sort(key=lambda i: (list(str(i)).count('0'), i), reverse=True)
	if list(str(arr[0])).count('0') == 0:
		return -1
	return arr[0]


def MaxZero(arr, n):
	c = 0
	m = 0
	a = []
	arr = sorted(arr)
	arr = arr[::-1]
	for i in arr:
		s = str(i)
		for j in s:
			if j == '0':
				c = c + 1
		a.append(c)
		c = 0
	m = a.index(max(a))
	if max(a) == 0:
		return -1
	else:
		return arr[m]


def MaxZero(arr, n):
	zero_cnt = 0
	g_zero_cnt = 0
	maxx = -1
	for num in arr:
		temp = num
		while num > 0:
			l = num % 10
			num = num // 10
			if l == 0:
				zero_cnt += 1
		if zero_cnt > g_zero_cnt:
			g_zero_cnt = zero_cnt
			maxx = temp
		elif zero_cnt == g_zero_cnt:
			maxx = max(temp, maxx)
		zero_cnt = 0
	if g_zero_cnt == 0:
		return -1
	return maxx


def cntZero(st):
	cnt = 0
	for i in st:
		if i == '0':
			cnt += 1
	return cnt

def MaxZero(arr, n):
	max_no = -1
	max_cnt = 0
	for i in arr:
		cnt = cntZero(str(i))
		if max_cnt < cnt:
			max_cnt = cnt
			max_no = i
		elif max_cnt == cnt:
			if max_no != -1 and max_no < i:
				max_no = i
	return max_no


def MaxZero(arr, n):
	count = 0
	num = -float('inf')
	for i in arr:
		j = str(i)
		co = j.count('0')
		if co == count:
			count = co
			if i >= num:
				num = i
		if co > count:
			count = co
			num = i
	if count == 0:
		return -1
	return num


def MaxZero(arr, n):
	l = {}
	m = []
	for i in arr:
		if '0' in str(i):
			l[i] = str(i).count('0')
		else:
			l[i] = -1
	k = max(l.values())
	for (i, j) in l.items():
		if j == k:
			m.append(i)
	if k == -1:
		return -1
	else:
		return max(m)


from functools import reduce

def MaxZero(arr, n):
	ans = -1
	c = 0
	for num in arr:
		if str(num).count('0') > c:
			c = str(num).count('0')
			ans = num
		elif str(num).count('0') == c and num > ans and (c != 0):
			ans = num
	return ans


def MaxZero(arr, n):
	c = -1
	num = -1
	for i in arr:
		l = str(i).count('0')
		if l != 0:
			if l > c:
				c = l
				num = i
			elif l == c and num < i:
				num = i
	return num


def MaxZero(arr, n):
	ans = 0
	m = 0
	for j in arr:
		c = 0
		i = j
		while i != 0:
			if i % 10 == 0:
				c += 1
			i = i // 10
		if c > ans:
			ans = c
			m = j
		elif c == ans:
			m = max(m, j)
	if ans != 0:
		return m
	return -1


def MaxZero(arr, n):
	maxi = 0
	value = 0
	for i in range(n):
		v = str(arr[i]).count('0')
		if v > maxi:
			maxi = v
			value = arr[i]
		elif v == maxi and arr[i] > value:
			value = arr[i]
	if maxi == 0:
		return -1
	else:
		return value


def MaxZero(arr, n):
	mx = -1
	mx_zeros = 0
	for i in range(0, n):
		x = arr[i]
		count = str(x).count('0')
		if count > mx_zeros:
			mx_zeros = count
			mx = arr[i]
		elif count == mx_zeros and count != 0:
			mx = arr[i] if arr[i] > mx else mx
	return mx


def MaxZero(arr, n):
	max_zero_count_element = -1
	max_zero_count = 0
	for element in arr:
		zero_count = 0
		temp = element
		while element > 0:
			digit = element % 10
			if digit == 0:
				zero_count += 1
			element = element // 10
		if zero_count > max_zero_count:
			max_zero_count = zero_count
			max_zero_count_element = temp
		elif max_zero_count != 0 and zero_count == max_zero_count:
			max_zero_count_element = max(max_zero_count_element, temp)
	return max_zero_count_element


def MaxZero(arr, n):
	zero_dict = {}
	for num in arr:
		cnt = 0
		for ch in str(num):
			if ch == '0':
				cnt += 1
		zero_dict[num] = cnt
	zero_cnt_arr = []
	for val in zero_dict.values():
		zero_cnt_arr.append(val)
	max_zero_cnt = max(zero_cnt_arr)
	if max_zero_cnt == 0:
		return -1
	num_arr = []
	for (key, val) in zero_dict.items():
		if val == max_zero_cnt:
			num_arr.append(key)
	return max(num_arr)


def MaxZero(arr, n):
	max_zero_count = 0
	res = -1
	for num in arr:
		tmp = num
		zero_count = 0
		while num:
			if num % 10 == 0:
				zero_count += 1
			num = num // 10
		if zero_count > max_zero_count:
			max_zero_count = zero_count
			res = tmp
		elif zero_count != 0 and zero_count == max_zero_count:
			res = max(res, tmp)
	return res


def MaxZero(arr, n):
	max = 0
	z = 0
	arr.sort()
	for i in arr:
		a = str(i)
		b = a.count('0')
		if b >= max:
			z = i
			max = b
	if max == 0:
		return -1
	return z


def MaxZero(arr, n):
	mx_zeros = 0
	my_num = float('-inf')
	res = 0
	for i in range(n):
		temp = arr[i]
		zeros = 0
		while temp > 0:
			if temp % 10 == 0:
				zeros += 1
			temp //= 10
		if zeros > mx_zeros:
			mx_zeros = zeros
			my_num = arr[i]
			res = i
		elif zeros == mx_zeros and arr[res] < arr[i]:
			res = i
			my_num = arr[i]
	if mx_zeros == 0:
		return -1
	return my_num


def MaxZero(arr, n):
	res = 0
	ans = 0
	for i in range(n):
		if str(arr[i]).count('0') > res:
			res = str(arr[i]).count('0')
			ans = arr[i]
		elif str(arr[i]).count('0') == res and res != 0:
			ans = max(ans, arr[i])
	if ans == 0:
		return -1
	else:
		return ans


def MaxZero(arr, n):
	m = 0
	highest = 0
	for i in range(n):
		z = str(arr[i]).count('0')
		if z > m:
			m = z
			highest = arr[i]
		elif z == m:
			highest = max(arr[i], highest)
	if m > 0:
		return highest
	else:
		return -1


def MaxZero(arr, n):
	max1 = 0
	num = 0
	arr.sort()
	for i in arr:
		j = str(i)
		count = 0
		for k in j:
			if k == '0':
				count += 1
		max1 = max(max1, count)
		if max1 == count:
			num = i
	if max1 != 0:
		return num
	return -1


def MaxZero(arr, n):
	max = -1
	count = 0
	zero = -1
	for i in range(len(arr)):
		c = arr[i]
		while arr[i] != 0:
			val = arr[i] % 10
			if val == 0:
				count += 1
			arr[i] = arr[i] // 10
		if count > zero:
			zero = count
			max = c
		elif count == zero and max < c:
			max = c
		count = 0
	if zero == 0:
		return -1
	else:
		return max


def MaxZero(arr, n):
	maxCount = 0
	maxNumber = 0
	for i in arr:
		temp = i
		count = 0
		while i >= 10:
			if i % 10 == 0:
				count += 1
			i = i // 10
		if count >= maxCount:
			if count == maxCount:
				num1 = temp
				num2 = maxNumber
				maxNumber = max(num1, num2)
			else:
				maxCount = count
				maxNumber = temp
	if maxCount != 0:
		return maxNumber
	else:
		return -1


def MaxZero(arr, n):
	c = 0
	s = ''
	for i in arr:
		if str(i).count('0') > c:
			c = str(i).count('0')
			s = str(i)
		elif str(i).count('0') == c and c != 0:
			s = str(max(i, int(s)))
	if c != 0:
		return int(s)
	else:
		return -1


def MaxZero(arr, n):
	a = [str(x) for x in arr]
	ans = '-1'
	MAX = 0
	for i in a:
		z = i.count('0')
		if z > MAX:
			MAX = z
			ans = i
		if z == MAX and z != 0 and (int(ans) < int(i)):
			ans = i
	return ans


def MaxZero(arr, n):
	m = 1
	x = -1
	for i in arr:
		if str(i).count('0') >= m:
			m = str(i).count('0')
			if m > str(x).count('0'):
				x = i
			else:
				x = max(x, i)
	if x == -1:
		return x
	return x


def MaxZero(arr, n):
	res = 0
	arr.sort(reverse=True)
	for i in range(n):
		s = str(arr[i])
		c = s.count('0')
		if c > res:
			res = c
			temp = int(s)
	if res == 0:
		return -1
	return temp


def MaxZero(arr, n):
	arr.sort()
	res = -1
	zeros = 0
	for i in range(n):
		count = 0
		v = arr[i]
		while v >= 10:
			t = v % 10
			if t == 0:
				count += 1
			v = v // 10
		if count >= zeros:
			zeros = count
			res = arr[i]
	if zeros == 0:
		return -1
	return res


def MaxZero(arr, n):
	x = 0
	ans = -1
	for i in arr:
		c = str(i).count('0')
		if c > 0:
			if c == x:
				if ans < i:
					ans = i
			elif c > x:
				ans = i
				x = c
	return ans


def MaxZero(arr, n):
	c = -9999
	for i in range(n):
		k = [int(x) for x in str(arr[i])]
		m = str(k).count('0')
		if m > c:
			c = m
			j = arr[i]
		if m == c and arr[i] > j:
			j = arr[i]
		if m == 0 and n == 1:
			j = 0
	if j != 0:
		return j
	else:
		return -1