def sort(a,n):
for i in range(0,n):
for j in range(i+1):
if a[i]<a[j]:
t=a[i]
a[i]=a[j]
a[j]=t
n=input()
a=[]
i=0
j=0
q=0
for i in range(0,n):
x=int(raw_input())
a.append(x)
sort(a,n)
for i in range(0,n-1):
if a[i+1]==a[i]+1:
q=q+1
if q==n-1:
print "YES"
The above is the solution to a Hackerearth problem, being new to python i am facing this NZEC error which bothers me a lot as i got no solution for this error.
Can someone please tell me why am i getting this error and whats the solution for the same