let a = Int(readLine()!)!
let s = readLine()!

var r:[Int] = []
var b:[Int] = []
var g:[Int] = []
var index = 1
var count = 0
for i in s {
    switch i {
    case "R":
        r.append(index)
    case "G":
        g.append(index)
    case "B":
        b.append(index)
    default:
        break
    }
    index+=1
}
//print(index)
for i in 0..<r.count {
    for j in 0..<g.count {
        for k in 0..<b.count {
            if r[i] != g[j]&&r[i] != b[k]&&g[j] != b[k]{
            if r[i] < g[j] || g[j] < b[k] {

                if g[j]-r[i] != b[k]-g[j]{
                    count += 1
                    }
                    print(String(r[i])+" "+String(g[j])+" "+String(b[k]))
                }
            }
        }
    }
}

print(count)