Hello coders, today we are going to solve **Dividing Stamps CodeChef Solution** whose Problem Code is **DIVIDING**.

**Task**

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Â **C _{i}**Â stamps in his collection. Your task is to determine if it is possible to redistributeÂ

**C**Â +Â

_{1}**C**Â + … +Â

_{2}**C**Â stamps among the members of SCC thus thatÂ

_{n}**i**‘th member would getÂ

**i**Â stamps.

**Input Format**

The first line contains one integer **N**, denoting the number of members of SCC.

The second line containsÂ **N**Â integersÂ **C _{i}**, denoting the numbers of the stamps in the collection ofÂ

**i**‘th member.

**Output Format**

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

**Constraints**

- 1 â‰¤Â
**N**Â â‰¤ 100 000; - 1 â‰¤Â
**C**Â â‰¤ 10_{i}^{9}.

**Examples**

**Sample Input** **0**

```
5
7 4 1 1 2
```

**Sample Output 0**

`YES`

**Sample Input 1**

```
5
1 1 1 1 1
```

**Sample Output 1**

`NO`

**Solution – Dividing Stamps **

**C++**

#include<bits/stdc++.h> using namespace std; typedef vector<long long int> vi; typedef long long ll; int main(){ ll n;cin>>n; ll sum = 0; for(ll i =0;i<n;i++){ ll num ;cin>>num; sum+=num; } if(sum == (n*(n+1))/2)cout<<"YES\n"; else cout<<"NO\n"; }

**Python**

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

**Java**

/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int nSum = 0; for(int i=n ; i>0 ; i--){ nSum+=i; } int[] arr = new int[n]; int arrSum = 0; for(int j=0 ; j<n ; j++){ arr[j] = sc.nextInt(); arrSum+=arr[j]; } if(arrSum==nSum){ System.out.println("YES"); } else{ System.out.println("NO"); } } }

**Disclaimer:** The above Problem **(Dividing Stamps)** is generated by **CodeChef **but the Solution is Provided by **CodingBroz**. This tutorial is only for** Educational** and **Learning** Purpose.