AtCoder Beginner Contest 085 - Kagami Mochi

An X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.
Lunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?

-----Constraints-----
 - 1 ≤ N ≤ 100
 - 1 ≤ d_i ≤ 100
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
N
d_1
:
d_N

-----Output-----
Print the maximum number of layers in a kagami mochi that can be made.

-----Sample Input-----
4
10
8
8
6

-----Sample Output-----
3

If we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.

Difficulty: EASY

Starter code:

Solutions:
n = int(input())
print(len(set((int(input()) for i in range(n)))))


N = int(input())
print(len({int(input()) for _ in range(N)}))


N = int(input())
d = [int(input()) for _ in range(N)]
d.sort()
ans = N
for i in range(N - 1):
	if d[i] == d[i + 1]:
		ans -= 1
print(ans)


(N, *D) = open(0)
print(len(set(D)))


with open(0) as f:
	(N, *d) = list(map(int, f.read().split()))
d = list(set(d))
print(len(d))


n = int(input())
print(len(set((int(input()) for _ in range(n)))))


N = int(input())
List = sorted(list(set(list((int(input()) for i in range(N))))))
print(len(List))


x = set([int(input()) for i in range(int(input()))])
print(len(x))


N = int(input())
d = [input() for _ in range(N)]
d = set(d)
print(len(d))


print(len(sorted(set([int(input()) for _ in [0] * int(input())]))))


a = int(input())
l = {int(input()) for i in range(a)}
print(len(l))


n = int(input())
d = list()
ans = 0
for i in range(n):
	d.append(int(input()))
	if d[i] not in d[:i]:
		ans += 1
print(ans)


n = int(input())
print(len(list(set([int(input()) for x in range(n)]))))


n = int(input())
d = []
for i in range(n):
	d.append(int(input()))
print(len(set(d)))


n = int(input())
d = [int(input()) for i in range(n)]
d = list(set(d))
print(len(d))


N = int(input())
D = []
for i in range(N):
	D.append(int(input()))
count = 0
preMax = 0
for i in range(N):
	if len(D) == 0:
		break
	if preMax != max(D):
		count += 1
		preMax = max(D)
	D.remove(max(D))
print(count)


N = int(input())
a = list((input() for i in range(N)))
print(len(set(a)))


N = int(input())
print(str(len(set([int(input()) for _ in range(N)]))))


N = int(input())
d = list([0] * N)
for i in range(N):
	d[i] = int(input())
d = set(d)
print(len(d))


i = [int(input()) for i in range(0, int(input()))]
print(len(set(i)))


n = int(input())
ls = [input() for i in range(n)]
s = set(ls)
print(len(s))


print(len({input() for x in [0] * int(input())}))


N = input()
d = [input() for i in range(int(N))]
print(len(set(d)))


(a, *b) = open(0)
print(len(set(b)))


N = int(input())
d = {int(input()): 1 for _ in range(N)}
print(len(d))


n = int(input())
d = len({int(input()) for i in range(n)})
print(d)


print(len({input() for i in range(int(input()))}))


N = int(input())
nums = [int(input()) for i in range(N)]
print(len(set(nums)))


n = int(input())
li = []
for i in range(n):
	li.append(int(input()))
li.sort(reverse=True)
cnt = 1
for i in range(n - 1):
	if li[i] > li[i + 1]:
		cnt += 1
print(cnt)


N = int(input())
d = []
for i in range(0, N):
	d += [int(input())]
d.sort(reverse=True)
ans = 0
x = max(d) + 1
for i in range(0, N):
	if d[i] < x:
		ans += 1
		x = d[i]
print(ans)


N = int(input())
lst = []
for i in range(N):
	lst.append(input())
print(len(set(lst)))


N = int(input())
d = [int(input()) for x in range(0, N)]
print(len(set(d)))


N = int(input())
moti_list = [int(input()) for i in range(N)]
moti_list.sort(reverse=True)
tower = 1
for j in range(N - 1):
	if moti_list[j] > moti_list[j + 1]:
		tower += 1
print(tower)


N = int(input())
s = [int(input()) for i in range(N)]
print(len(set(s)))


(_, *d) = map(int, open(0).read().split())
print(len(set(d)))


n = int(input())
d = [input() for _ in range(n)]
ans = len(set(d))
print(ans)


from typing import List

def answer(n: int, d: List[int]) -> int:
	return len(set(d))

def main():
	n = int(input())
	d = list((int(input()) for _ in range(n)))
	print(answer(n, d))

def __starting_point():
	main()
__starting_point()


(n, *d) = map(int, open(0).read().split())
print(len(set(d)))


a = int(input())
b = set((int(input()) for i in range(a)))
print(len(b))


(_, *d) = open(0)
print(len(set(d)))


N = int(input())
M = [input() for _ in range(N)]
print(len(set(M)))


n = int(input())
l = list([])
for i in range(n):
	l.append(int(input()))
s = set(l)
print(len(s))


n = int(input())
n_list = []
for i in range(n):
	n_list.append(int(input()))
print(len(set(n_list)))


N = int(input())
int_list = []
for _ in range(N):
	int_list.append(int(input()))
int_list.sort()
print(len(set(int_list)))


n = int(input())
d = list((input() for _ in range(n)))
print(len(set(d)))


print(len(set(sorted([int(input()) for i in range(int(input()))]))))


def kagami_mochi():
	n = int(input())
	d = []
	for _ in range(n):
		d.append(int(input()))
	d.sort()
	d_unique = list(set(d))
	print(len(d_unique))

def __starting_point():
	kagami_mochi()
__starting_point()


n = int(input())
data = []
for i in range(0, n):
	data.append(int(input()))
res = sorted(data)
c = 1
for j in range(1, n):
	if res[j] != res[j - 1]:
		c = c + 1
print(c)


n = int(input())
d = {int(input()) for _ in range(n)}
print(len(d))


N = int(input())
l = [input() for i in range(N)]
print(len(set(l)))


n = int(input())
s = {int(input()) for _ in range(n)}
print(len(s))


N = int(input())
D = {input() for i in range(N)}
print(len(D))


num = int(input())
table = []
for i in range(num):
	table.append(int(input()))
setting = set(table)
print(len(setting))


N = int(input())
d = []
for i in range(N):
	d.append(int(input()))
num = [0] * (max(d) + 1)
for i in range(N):
	num[d[i]] += 1
res = 0
for i in range(max(d) + 1):
	if num[i]:
		res += 1
print(res)


(n, *L) = map(int, open(0).read().split())
print(len(set(L)))


n = int(input())
d = [input() for x in range(n)]
print(len(set(d)))


(n, *l) = map(int, open(0).read().split())
print(len(set(l)))


n = int(input())
a = set()
for _ in range(n):
	a.add(int(input()))
print(len(a))


(_, *d) = open(0).read().split()
print(len(set(d)))


print(len(set(open(0).read().split()[1:])))


N = int(input())
d = []
for i in range(N):
	d.append(int(input()))
d.sort(reverse=True)
step = 1
for i in range(N - 1):
	if d[i] > d[i + 1]:
		step += 1
print(step)


import sys
sys.setrecursionlimit(10 ** 6)
n = int(input())
d = [int(input()) for i in range(n)]
print(len(set(d)))


N = int(input())
print(len(set([int(input()) for x in range(N)])))


(n, *a) = map(int, open(0).read().split())
print(len(set(a)))


(N, *D) = map(int, open(0).read().split())
print(len(set(D)))


N = int(input())
D = [int(input()) for _ in range(N)]
D.sort()
count = 1
for i in range(1, len(D)):
	if D[i] != D[i - 1]:
		count += 1
print(count)


n = int(input())
print(len(set([int(input()) for a in range(n)])))


N = int(input())
d = []
for _ in range(N):
	d.append(int(input()))
d.sort(reverse=True)
top = 101
ans = 0
for d_ in d:
	if d_ < top:
		ans += 1
		top = d_
print(ans)


import sys
(input(), print(len(set(sys.stdin.read().strip().split()))))


N = int(input())
D = [input() for _ in range(N)]
print(len(set(D)))


N = int(input())
d = []
for i in range(N):
	d.append(int(input()))
dic = {}
for i in range(N):
	if d[i] in dic:
		dic[d[i]] += 1
	else:
		dic[d[i]] = 1
print(len(dic))


n = int(input())
lst = []
for i in range(n):
	d = int(input())
	lst.append(d)
res = sorted(list(set(lst)))
print(len(res))


def main():
	n = int(input())
	print(len(set([int(input()) for i in range(n)])))

def __starting_point():
	main()
__starting_point()


n = int(input())
s = {int(input()) for i in range(n)}
print(len(s))


N = int(input())
ds = []
mochidan = 0
for i in range(N):
	ds.append(int(input()))
while ds:
	tmp = max(ds)
	ds = [j for j in ds if j < tmp]
	mochidan += 1
print(mochidan)


import sys
from typing import List

def fast_input():
	return sys.stdin.readline()[:-1]

def solve(mochi_list: List[int]) -> int:
	sorted_mochi_list = sorted(mochi_list)
	kagamimochi = set(sorted_mochi_list)
	return len(kagamimochi)

def main():
	n = int(fast_input())
	d = []
	for i in range(n):
		d.append(int(fast_input()))
	result = solve(d)
	print(result)
main()


(_, *s) = open(0)
print(len(set(s)))


(*a,) = map(int, open(0))
print(len(set(a[1:])))


import sys
print(len(set(sys.stdin.read().split('\n')[1:-1])))


n = int(input())
D = []
for _ in range(n):
	d = int(input())
	D += [d]
print(len(set(D)))


print(len(list(set([int(input()) for i in range(int(input()))]))))


a = int(input())
print(len({int(input()): '' for _ in range(a)}))


N = int(input())
S = set([input() for i in range(N)])
print(len(S))


N = int(input())
A = {int(input()) for i in range(N)}
print(len(A))


N = int(input())
P = [int(input()) for _ in range(N)]
print(len(set(P)))


N = int(input())
A = sorted([input() for _ in range(N)])
print(len(set(A)))


n = int(input())
st = set()
for i in range(0, n):
	a = input()
	st.add(a)
print(len(st))


n = int(input())
d = [int(input()) for i in range(n)]
d = sorted(d, reverse=True)
ans = 0
last = 101
for i in d:
	if i < last:
		ans += 1
		last = i
print(ans)


n = int(input())
q = len(list(set([int(input()) for i in range(n)])))
print(q)


N = int(input())
d_lst = []
D_lst = []
cnt = 0
for i in range(N):
	d = int(input())
	d_lst.append(d)
for j in range(max(d_lst) + 1):
	D = d_lst.count(j)
	D_lst.append(D)
	if D == 0:
		pass
	else:
		cnt += 1
print(cnt)


print(len({input() for _ in [0] * int(input())}))


(n, *aa) = map(int, open(0).read().split())
aa = set(aa)
print(len(aa))


N = int(input())
d = set()
for i in range(N):
	a = int(input())
	d.add(a)
print(len(d))


n = int(input())
d = {input(): 1 for i in range(n)}
print(sum(d.values()))


N = int(input())
z = []
for num in range(101):
	z.append(0)
counter = 0
while counter < N:
	d = int(input())
	z[d] = 1
	counter += 1
result = sum(z)
print(result)


N = int(input())
d = {}
dupli = 0
for _ in range(N):
	i = input()
	if i in d:
		d[i] += 1
		dupli += 1
	else:
		d[i] = 0
print(str(N - dupli))


from sys import stdin
n = int(stdin.readline().rstrip())
a = [0] * n
for x in range(n):
	a[x] = int(stdin.readline().rstrip())
a.sort(reverse=True)
sum = 1
for x in range(n - 1):
	if a[x] > a[x + 1]:
		sum += 1
print(sum)


print(len(set(list(map(int, open(0).read().split()))[1:])))


N = int(input())
list1 = []
for i in range(N):
	list1.append(int(input()))
set1 = set(list1)
ans = len(set1)
print(ans)


def get_unique_list(seq):
	seen = []
	return [x for x in seq if x not in seen and (not seen.append(x))]
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
b = get_unique_list(a)
print(len(b))


N = int(input())
l = [input() for _ in range(N)]
print(len(set(l)))


import sys

def input():
	return sys.stdin.readline().rstrip()
N = int(input())
D = []
for i in range(N):
	d = int(input())
	D.append(d)
D_set = set(D)
ans = len(D_set)
print(ans)


N = int(input())
print(len(set(list((input() for _ in range(N))))))


n = int(input())
mochi_set = set()
for i in range(n):
	size = int(input())
	mochi_set.add(size)
print(len(mochi_set))


N = int(input())
print(len(set(map(int, [input() for i in range(N)]))))


print(len(set(list((input() for _ in [0] * int(input()))))))


N = int(input())
D = sorted([int(input()) for _ in range(N)], reverse=True)
cnt = 1
for i in range(len(D) - 1):
	if D[i] <= D[i + 1]:
		pass
	else:
		cnt += 1
print(cnt)


N = int(input())
D = []
for _ in range(N):
	d = int(input())
	D.append(d)
D_num = list(set(D))
print(len(D_num))


n = int(input())
d = set()
for i in range(n):
	d.add(int(input()))
print(len(d))


N = int(input())
D = set((int(input()) for T in range(N)))
print(len(D))


N = int(input())
d = [input() for i in range(N)]

def ans085(N: int, d: str):
	d = map(int, d)
	return len(set(d))
print(ans085(N, d))


num = int(input())
a = []
for i in range(num):
	n = int(input())
	a.append(n)
myset = set(a)
len_list = len(frozenset(myset))
print(len_list)


N = int(input())
d = [int(input()) for i in range(N)]
original = []
for i in d:
	if i not in original:
		original.append(i)
print(len(original))


N = int(input())
m = []
for i in range(N):
	m.append(int(input()))
m = sorted(set(m))
print(len(m))


N = int(input())
num_list = []
for n in range(N):
	num = int(input())
	num_list.append(num)
ans = len(set(num_list))
print(ans)


print(len(set(open(0).readlines()[1:])))


N = int(input())
d_list = []
Height = 0
for i in range(N):
	d_list.append(int(input()))
while d_list != []:
	MAX_Value = max(d_list)
	while MAX_Value == max(d_list):
		d_list.remove(MAX_Value)
		if d_list == []:
			break
	Height += 1
print(Height)


N = input()
N = int(N)
li = []
for i in range(N):
	li.append(input())
ans = 0
a = []
b = 0
for i in range(101):
	a.append(i - i)
for i in range(N):
	b = li[i]
	b = int(b)
	a[b] = 1
for i in range(101):
	ans += a[i]
print(ans)


import sys
n = int(input())
print(len(set(map(int, sys.stdin))))


n = int(input())
D = []
for i in range(n):
	D.append(int(input()))
D = set(D)
print(len(D))


def main():
	n = int(input())
	d = set((int(input()) for _ in range(n)))
	print(len(d))
main()


N = int(input())
print(len(set([input() for n in range(N)])))


n = int(input())
a = sorted([input() for i in range(n)])
c = 1
for i in range(n - 1):
	if a[i] < a[i + 1]:
		c += 1
print(c)


print(len({int(input()) for x in range(int(input()))}))


n = int(input())
xs = {int(input()) for i in range(n)}
print(len(xs))


N = int(input())
d = []
for i in range(N):
	d.append(int(input()))
cnt = 0
for i in range(1, 101):
	qual = 0
	for j in d:
		if i == j:
			qual = 1
	if qual == 1:
		cnt += 1
print(cnt)


n = int(input())
key = []
ans = 0
for _ in range(n):
	s = int(input())
	if s not in key:
		key.append(s)
		ans += 1
print(ans)


n = int(input())
list_d = sorted([int(input()) for i in range(0, n)], reverse=True)
list_ans = []
for i in range(0, len(list_d)):
	if list_d[i] not in list_ans:
		list_ans.append(list_d[i])
print(len(list_ans))


N = int(input())
S = set((int(input()) for _ in range(N)))
print(len(S))


n = int(input())
k = sorted({input() for i in range(n)})
print(len(k))


N = int(input())
d = []
for i in range(N):
	d.append(int(input()))
dset = set(d)
print(len(dset))


N = int(input())
d = [int(input()) for i in range(N)]
d.sort(reverse=True)
ans = 0
ind = 100000
for i in range(N):
	if d[i] < ind:
		ans += 1
		ind = d[i]
print(ans)