https://www.acmicpc.net/problem/12789
import sys
from collections import deque
input = sys.stdin.readline
num = int(input())
student = deque(list(map(int, input().split())))
stack = []
order = 1
while student:
if student and order != student[0]:
stack.append(student.popleft())
elif student and order == student[0]:
order += 1
student.popleft()
while stack and order == stack[-1]:
stack.pop()
order += 1
print("Nice" if not stack else "Sad")