Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(){
- long long n,dem=0;
- long long a[100000];
- scanf("%lld", &n);
- for(int i=0;i<n;i++){
- scanf("%lld", &a[i]);
- }
- for(int i=0;i<n;i++){
- if(a[i+1]==a[i]+1)
- dem++;
- }
- if(dem==n-1){
- printf("YES");
- }
- else{
- printf("NO");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement