Buggy python submission (verdict: Runtime Error):
N = int(input())
ori = [int(i) for i in input().split()]
count = ori.count(1)
if count == 0:
    print(-1)

else:
    Break = 0
    for j in range(1,N+1):
        for i in range(Break+1,N):
            if ori[i] == j:
                Break = i
                #print(Break)
                #print(savepoint)
                #print(j,i)
                sub = j
                break
        if i == N-1:
            break
    print(Break+1-sub)

Fixed submission:
N = int(input())
ori = [int(i) for i in input().split()]
count = ori.count(1)
if count == 0:
    print(-1)

else:
    savepoint = 0
    for j in range(1,N+1):
        for i in range(savepoint,N):
            if ori[i] == j:
                savepoint = i
                #print(savepoint)
                #print(j,i)
                sub = j
                break
        if i == N-1:
            break
    print(N-sub)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ori = [int(i) for i in input().split()]
count = ori.count(1)
if count == 0:
    print(-1)
Break = 0
quit  = 0
for j in range(1,N+1):
    for i in range(Break,N):
        if ori[i] == j:
            Break = i
            #print(Break)
            #print(savepoint)
            #print(j,i)
            sub = j
            break
    if i == N-1:
        break
        #else: 
            #quit = 1
            #break
    #if quit == 1:
        #print(quit)
        #break
print(Break+1-sub)

Fixed submission:
N = int(input())
ori = [int(i) for i in input().split()]
count = ori.count(1)
if count == 0:
    print(-1)

else:
    savepoint = 0
    for j in range(1,N+1):
        for i in range(savepoint,N):
            if ori[i] == j:
                savepoint = i
                #print(savepoint)
                #print(j,i)
                sub = j
                break
        if i == N-1:
            break
    print(N-sub)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ori = [int(i) for i in input().split()]
#print(N,ori)
count = ori.count(1)
#print(count)
if count == 0:
    print(-1)
Break = 0
quit  = 0
for j in range(1,N+1):
    for i in range(Break+1,N):
        if ori[i] == j:
            Break = i
            #print(Break)
            #print(savepoint)
            #print(j,i)
            sub = j
            break
        #else: 
            #quit = 1
            #break
    #if quit == 1:
        #print(quit)
        #break
print(Break+1-sub)

Fixed submission:
N = int(input())
ori = [int(i) for i in input().split()]
count = ori.count(1)
if count == 0:
    print(-1)

else:
    savepoint = 0
    for j in range(1,N+1):
        for i in range(savepoint,N):
            if ori[i] == j:
                savepoint = i
                #print(savepoint)
                #print(j,i)
                sub = j
                break
        if i == N-1:
            break
    print(N-sub)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ori = [int(i) for i in input().split()]
print(N,ori)
count = ori.count(1)
print(count)
if count == 0:
    print(-1)
savepoint = 0
Break = 0
quit  = 0
for j in range(1,N+1):
    for i in range(savepoint+1,N):
        if ori[i] == j:
            Break = i
            savepoint = i
            #print(Break)
            #print(savepoint)
            #print(j,i)
            sub = j
            break
        #else: 
            #quit = 1
            #break
    #if quit == 1:
        #print(quit)
        #break
print(Break+1-sub)

Fixed submission:
N = int(input())
ori = [int(i) for i in input().split()]
count = ori.count(1)
if count == 0:
    print(-1)

else:
    savepoint = 0
    for j in range(1,N+1):
        for i in range(savepoint,N):
            if ori[i] == j:
                savepoint = i
                #print(savepoint)
                #print(j,i)
                sub = j
                break
        if i == N-1:
            break
    print(N-sub)