Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)
 
ans = 0
 
med = [0 for x in range(alen +1)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1
 
for i in range(len(med)):
    if med[i] == 1:
        if med[i+1] == 1:
            med[i+1] = 0
            ans += 1
        else:
            ans += 1
        
print(ans)

Fixed submission:
n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +2)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1

for i in range(len(med)):
    if med[i] == 1:
        if med[i+1] == 1:
            med[i+1] = 0
            ans += 1
        else:
            ans += 1
        
print(ans)

Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int,input().split()))
a.insert(0.5)
alen = len(a)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +1)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1
 
for i in range(len(med)):
    if med[i] == 1:
        if med[i+1] == 1:
            med[i+1] = 0
            ans += 1
        else:
            ans += 1
        
print(ans)

Fixed submission:
n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +2)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1

for i in range(len(med)):
    if med[i] == 1:
        if med[i+1] == 1:
            med[i+1] = 0
            ans += 1
        else:
            ans += 1
        
print(ans)

Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +1)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1
 
for i in range(len(med)):
    if med[i] == 1:
      if med[i+1] == 1:
          med[i+1] = 0
          ans += 1
      else:
        ans += 1
        
print(ans)

Fixed submission:
n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +2)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1

for i in range(len(med)):
    if med[i] == 1:
        if med[i+1] == 1:
            med[i+1] = 0
            ans += 1
        else:
            ans += 1
        
print(ans)

Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int,input().split()))
a.insert(0.5)
alen = len(a)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +1)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1
 
for i in range(len(med)):
    if med[i] == 1:
      if med[i+1] == 1:
          med[i+1] = 0
          ans += 1
      else:
        ans += 1
        
print(ans)

Fixed submission:
n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +2)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1

for i in range(len(med)):
    if med[i] == 1:
        if med[i+1] == 1:
            med[i+1] = 0
            ans += 1
        else:
            ans += 1
        
print(ans)

Buggy python submission (verdict: Runtime Error):
def swap(a,b,c):
    x = a[b]
    a[b] = a[c]
    a[c] = x
 
     
n = input()
a = list(map(int,input().split()))
alen = len(a)
a.append(0.5)
a.append(0.5)
ans = 0
 
med = [0 for x in range(alen +3)]
 
for i in range(alen):
    if a[i] == i+1:
        med[i+1] = 1
 
for i in range(len(med)):
    if med[i] == 1:
      if med[i+1] == 1:
            swap(a,a[i-1],a[i])
			med[i+1] == 0
            ans += 1
      else:
        swap(a,i,i+1)
        ans += 1
        
print(ans)

Fixed submission:
n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +2)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1

for i in range(len(med)):
    if med[i] == 1:
        if med[i+1] == 1:
            med[i+1] = 0
            ans += 1
        else:
            ans += 1
        
print(ans)

Buggy python submission (verdict: Runtime Error):
def swap(a,b,c):
    x = a[b]
    a[b] = a[c]
    a[c] = x

     
n = input()
a = list(map(int,input().split()))
alen = len(a)
a.append(0.5)
a.append(0.5)
ans = 0

med = [0 for x in range(alen +3)]

for i in range(alen):
    if a[i] == i+1:
        med[i+1] = 1

for i in range(len(med)):
    if med[i] == 1:
      if med[i+1] == 1:
            swap(a,a[i-1],a[i])
          	med[i+1] == 0
            ans += 1
      else:
        swap(a,i,i+1)
        ans += 1
        
print(ans)

Fixed submission:
n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +2)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1

for i in range(len(med)):
    if med[i] == 1:
        if med[i+1] == 1:
            med[i+1] = 0
            ans += 1
        else:
            ans += 1
        
print(ans)