Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if not(cn[i]):
        for j in range(k,0,-1):

            if cn[j]:
                k =j-1
                if i < j:
                    #cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
                elif i>=j:
                    b=1
                    break
print(ans)

Fixed submission:
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if not(cn[i]):
        for j in range(k,0,-1):

            if cn[j]:
                k =j-1
                if i < j:
                    #cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
            if i>=j:
                b=1
                break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if cn[i]== False:
        for j in range(k,0,-1):

            if cn[j]==True:
                k =j-1
                if i < j:
                    #cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
                elif i>=j:
                    b=1
                    break
print(ans)

Fixed submission:
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if not(cn[i]):
        for j in range(k,0,-1):

            if cn[j]:
                k =j-1
                if i < j:
                    #cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
            if i>=j:
                b=1
                break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if cn[i]== False:
        for j in range(k,0,-1):

            if cn[j]==True:
                k =j-1
                if i < j:
                    cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
                elif i>=j:
                    b=1
                    break
print(ans)

Fixed submission:
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if not(cn[i]):
        for j in range(k,0,-1):

            if cn[j]:
                k =j-1
                if i < j:
                    #cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
            if i>=j:
                b=1
                break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if cn[i]== False:
        for j in range(k,0,-1):

            if cn[j]==True:
                k =j
                if i < j:
                    cn[i]=True
                    cn[j]=False
                    ans +=1
                    break
                elif i>=j:
                    b=1
                    break
print(ans)

Fixed submission:
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if not(cn[i]):
        for j in range(k,0,-1):

            if cn[j]:
                k =j-1
                if i < j:
                    #cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
            if i>=j:
                b=1
                break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if cn[i]== 0:
        for j in range(k,0,-1):

            if cn[j]==1:
                k =j
                if i < j:
                    cn[i]=1
                    cn[j]=0
                    ans +=1
                    break
                elif i>=j:
                    b=1
                    break
print(ans)

Fixed submission:
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if not(cn[i]):
        for j in range(k,0,-1):

            if cn[j]:
                k =j-1
                if i < j:
                    #cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
            if i>=j:
                b=1
                break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = str(input())
cn = [0]*n
for i in range(n):
    if c[i]=="R":
        cn[i]=1


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break
   
    if cn[i]== 0:
        for j in range(k,0,-1):

            if cn[j]==1:
                k =j
                if i < j:
                    cn[i]=1
                    cn[j]=0
                    ans +=1
                    break
                elif i>=j:
                    b=1
                    break
print(ans)

Fixed submission:
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if not(cn[i]):
        for j in range(k,0,-1):

            if cn[j]:
                k =j-1
                if i < j:
                    #cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
            if i>=j:
                b=1
                break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = str(input())
cn = [0]*n
for i in range(n):
    if c[i]=="R":
        cn[i]=1


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break
   
    if cn[i]== 0:
        for j in range(k,0,-1):

            if cn[j]==1:
                k =j
                if i < j:
                    cn[i]=1
                    cn[j]=0
                    ans +=1
                    break
                elif i>=j:
                    b=1
                    break
print(ans)

Fixed submission:
n = int(input())
c = str(input())
cn = [False]*n
for i in range(n):
    if c[i]=="R":
        cn[i]= True


ans = 0
k=n-1
b=0

for i in range(n):
    if b==1:
        break

    if not(cn[i]):
        for j in range(k,0,-1):

            if cn[j]:
                k =j-1
                if i < j:
                    #cn[i]=True
                    #cn[j]=False
                    ans +=1
                    break
            if i>=j:
                b=1
                break
print(ans)