n=int(eval(input()))

s=eval(input())



r=s.count('R')

g=s.count('G')

b=s.count('B')



ans=r*g*b



for i in range(n):

    for d in range(n):

        j=i+d

        k=j+d

        if k>=n: break

        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:

            ans-=1



print(ans)

n=int(eval(input()))

s=eval(input())



r=s.count('R')

g=s.count('G')

b=s.count('B')



ans=r*g*b



for i in range(n):

    for d in range(n):

        j=i+d

        k=j+d

        if k<n:

            if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:

                ans-=1



print(ans)

n = int(eval(input()))
s = eval(input())
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
print(ans)

n = int(eval(input()))
s = eval(input())
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k < n:
            if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
                ans -= 1
print(ans)

-        if k >= n: -            break -        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]: -            ans -= 1 +        if k < n: +            if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]: +                ans -= 1