Are you fond of collecting some kind of stuff? Mike is crazy about collecting stamps. He is an active member of Stamp Collecting Сommunity(SCC). 

SCC consists of N members which are fond of philately. A few days ago Mike argued with the others from SCC. Mike told them that all stamps of the members could be divided in such a way that i'th member would get i postage stamps. Now Mike wants to know if he was right. The next SCC meeting is tomorrow. Mike still has no answer.

So, help Mike! There are N members in the SCC, i'th member has Ci stamps in his collection. Your task is to determine if it is possible to redistribute C1 + C2 + ... + Cn stamps among the members of SCC thus that i'th member would get i stamps.

-----Input-----
The first line contains one integer N, denoting the number of members of SCC.
The second line contains N integers Ci, denoting the numbers of the stamps in the collection of i'th member.

-----Output-----
The first line should contain YES, if we can obtain the required division, otherwise NO.

-----Constraints-----
1 ≤ N ≤ 100 000;
1 ≤  Ci ≤ 109.

-----Examples-----
Input:
5
7 4 1 1 2

Output:
YES

Input:
5
1 1 1 1 1

Output:
NO

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
N = int(input())
C = list(map(int, input().split()))
if sum(C) == N * (N + 1) // 2:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = 0
for i in range(n):
	b = b + (i + 1)
if b == sum(a):
	print('YES')
else:
	print('NO')


n = int(input())
line = input()
words = line.split()
nums = [int(w) for w in words]
s = (n + 1) * n // 2
if s == sum(nums):
	print('YES')
else:
	print('NO')


try:
	N = int(input())
	lst = sorted(list(map(int, input().split())))
	sum = 0
	for i in range(N):
		sum = sum + lst[i]
	sum2 = 0
	for i in range(1, N + 1):
		sum2 = sum2 + i
	if sum2 == sum:
		print('YES')
	else:
		print('NO')
except:
	pass


n = int(input())
c = list(map(int, input().split()))
if sum(c) == n * (n + 1) // 2:
	print('YES')
else:
	print('NO')


n = int(input())
c = list(map(int, input().split()))
count = 0
for i in c:
	count += i
if count == n * (n + 1) // 2:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()[:n]))
k = n * (n + 1) // 2
if sum(l) == k:
	print('YES')
else:
	print('NO')


n = int(input())
s = list(map(int, input().split()))
sum = 0
x = n * (n + 1) * 0.5
for num in s:
	sum = sum + num
if sum == x:
	print('YES')
else:
	print('NO')


n = int(input())
s = 0
l = list(map(int, input().split()))
for i in l:
	s += i
if n * (n + 1) / 2 == s:
	print('YES')
else:
	print('NO')


import math
n = int(input())
li = sum(list(map(int, input().split())))
if li != n * (n + 1) / 2:
	print('NO')
else:
	print('YES')


try:
	n = int(input())
	stampArr = list(map(int, input().split()))
	nsum = sum(range(1, n + 1))
	ssum = sum(stampArr)
	if nsum == ssum:
		print('YES')
	else:
		print('NO')
except:
	pass


import math
n = int(input())
c = list(map(int, input().split()))
k = 0
u = 1
for i in range(n):
	k += c[i]
if k % n == 0 and k // n > 1:
	print('YES')
else:
	print('NO')


n = int(input())
L = [int(x) for x in input().split()]
s = sum(L)
if s == n * (n + 1) // 2:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
tot = 0
n = len(l)
for j in l:
	tot += j
if n * (n + 1) / 2 == tot:
	print('YES')
else:
	print('NO')


l = []
n = int(input())
x = map(int, input().split())
x1 = sum(x)
for i in range(1, n + 1):
	l.append(i)
l1 = sum(l)
if x1 == l1:
	print('YES')
else:
	print('NO')


s = int(input())
a = list(map(int, input().split(' ')))
count = 0
count_first = 0
for j in range(s):
	count += a[j]
for k in range(1, s + 1):
	count_first += k
if count == count_first:
	print('YES')
else:
	print('NO')


t = int(input())
a = list(map(int, input().split()))
n = sum(a)
if t * (t + 1) // 2 == n:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().strip().split()))
s = sum(l)
k = 0
for i in range(0, len(l) + 1):
	k = k + i
if s == k:
	print('YES')
else:
	print('NO')


n = int(input())
arr = list(map(int, input().split()))
s1 = sum(arr)
s2 = n * (n + 1) / 2
if s1 == s2:
	print('YES')
else:
	print('NO')


a = int(input())
b = list(map(int, input().split()))
sum = 0
for x in b:
	sum = sum + x
count = 0
for j in range(a + 1):
	count = count + j
if sum == count:
	print('YES')
else:
	print('NO')


l = list()
n = int(input())
x = [int(item) for item in input().split()]
sum1 = sum(x)
j = 1
while n:
	l.append(j)
	j = j + 1
	n = n - 1
if sum1 == sum(l):
	print('YES')
else:
	print('NO')


import math
n = int(input())
l = list(map(int, input().split()))
s = sum(l)
z = math.trunc(math.sqrt(1 + 8 * s))
z = (-1 + z) // 2
if z == n:
	print('YES')
else:
	print('NO')


N = int(input())
A = list(map(int, input().split()))
c = sum(A)
if c == N * (N + 1) // 2:
	print('YES')
else:
	print('NO')


N = int(input())
A = list(map(int, input().split()))
c = 0
for i in A:
	c = c + i
if c == N * (N + 1) // 2:
	print('YES')
else:
	print('NO')


import math as m
n = int(input())
l = list(map(int, input().split()))
c = 0
z = n * (n + 1) // 2
for j in l:
	c += j
if c == z:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	l1 = list(map(int, input().split()))
	N = n * (n + 1) / 2
	sum1 = 0
	for i in range(n):
		sum1 += l1[i]
	if sum1 == N:
		print('YES')
	else:
		print('NO')
main()


(ns, si) = (int(input()), list(map(int, input().split())))
print('YES') if int(ns * (ns + 1) / 2) == sum(si) else print('NO')


n = int(input())
s = 0
l = list(map(int, input().split()))
for i in range(1, n + 1):
	s = s + i
p = sum(l)
if sum(l) == s:
	print('YES')
else:
	print('NO')


import sys
(n, c) = (int(sys.stdin.readline()), sum(map(int, sys.stdin.readline().split())))
sys.stdout.write('YES\n' if c == n * (n + 1) / 2 else 'NO\n')


x = int(input())
y = list(map(int, input().split()))
if sum(y) == x * (x + 1) / 2:
	print('YES')
else:
	print('NO')


a = int(input())
b = a * (a + 1) / 2
c = sum(list(map(int, input().split())))
if c == b:
	print('YES')
else:
	print('NO')


t = int(input())
p = list(map(int, input().split()))
count = 0
for i in p:
	count = count + i
if count == t * (t + 1) // 2:
	print('YES')
else:
	print('NO')


t = int(input())
x = list(map(int, input().split()))
n1 = sum(x)
n2 = t * (t + 1) // 2
if n1 == n2:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(x) for x in input().split()]
k = n * (n + 1) // 2
if k == sum(a):
	print('YES')
else:
	print('NO')


q = int(input())
l = list(map(int, input().split()))
s = sum(l)
n = q * (q + 1) // 2
if s == n:
	print('YES')
else:
	print('NO')


n = int(input())
summ = 0
arr = list(map(int, input().split()))
avg = n * (n + 1) // 2
for i in range(n):
	summ = summ + arr[i]
if summ == avg:
	print('YES\n')
else:
	print('NO\n')


from collections import Counter, defaultdict
from sys import stdin, stdout, setrecursionlimit
from heapq import nlargest, nsmallest
import math
setrecursionlimit(2147400000)

def outnl(x):
	stdout.write(str(x) + '\n')

def outsl(x):
	stdout.write(str(x) + ' ')

def instr():
	return stdin.readline().strip()

def inint():
	return int(stdin.readline())

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

def inlist():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(1):
	n = inint()
	l = sum(inlist())
	if l == n * (n + 1) // 2:
		print('YES')
	else:
		print('NO')


try:
	n = int(input())
	l = [int(x) for x in input().split()]
	if n * (n + 1) // 2 == sum(l):
		print('YES')
	else:
		print('NO')
except:
	pass


wife = int(input())
life = list(map(int, input().split()))
aim = 0
for death in life:
	aim = aim + death
if aim == wife * (wife + 1) // 2:
	print('YES')
else:
	print('NO')


l = int(input())
a = [int(x) for x in input().split()]
if sum(a) == l * (l + 1) // 2:
	print('YES')
else:
	print('NO')


N = int(input())
total = sum(list(map(int, input().split())))
required = N * (N + 1) / 2
print('YES' if required == total else 'NO')


n = int(input())
A = list(map(int, input().split()))
add = sum(A)
req = n * (n + 1) // 2
if add == req:
	print('YES')
else:
	print('NO')


people = int(input())
collectionlist = list(map(int, input().split()))
sumstamps = sum(collectionlist)
reqstamps = people * (people + 1) / 2
if sumstamps != reqstamps:
	print('NO')
else:
	print('YES')


def versus():
	if sum(a) == sum(range(1, n + 1)):
		return 'YES'
	else:
		return 'NO'
n = int(input())
a = [int(x) for x in input().split()]
print(versus())


n = int(input())
a = [int(y) for y in input().split()]
if sum(a) == n * (n + 1) / 2:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(i) for i in input().split()]
ans = sum(a)
x = n * (n + 1) // 2
if ans == x:
	print('YES')
else:
	print('NO')