jiahuimbzuai/CoQuIR huggingface dataset:
//  [swift]
import Foundation

func readInts() -> [Int] {
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let ab = readInts()
    let (a,b) = (ab[0],ab[1])
    var cost = a * 10
    
    for _ in 0...100 {
        if cost * 8 / 100 == a && cost * 10 / 100 == b {
            print(cost)
            return
        }
        cost += 1
    }
    print(-1)
}
main()
//  [swift]
import Foundation

func readInts() -> [Int] {
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let ab = readInts()
    let (a,b) = (ab[0],ab[1])
    var cost = a * 10
    
    for _ in 0...100 {
        print(cost, cost * 8 / 100, cost * 10 / 100)
        if cost * 8 / 100 == a && cost * 10 / 100 == b {
            print(cost)
            return
        }
        cost += 1
    }
    print(-1)
}
main()
//  [typescript]
function main(input) {
  const inputs =input.split('\n')
  const [A, B] = inputs[0].split(' ').map(Number)
  for(let i = 1; i <= 1000; i++) {
    if (Math.floor(i * 0.08) === A && Math.floor(i * 0.1) === B) {
      console.log(i)
      return
    }
  }
  console.log('-1')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [typescript]
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [a, b]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    const aY = Math.ceil(a / 0.08);
    const bY = Math.ceil(b / 0.1);
    const aU = Math.ceil((a + 1) / 0.08) - 1;
    const bU = Math.ceil((b + 1) / 0.1) - 1;
    return `${bU < aY || aU < bY ? -1 : Math.max(aY, bY)}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [a, b] = input[0].split(" ").map((x: string): number => +x);

const lb = Math.floor(Math.min(a / 0.08, b / 0.1)) - 1;
const ub = Math.floor(Math.max(a / 0.08, b / 0.1)) + 1;

let result = -1;
for (let i = lb; i <= ub; i++) {
	if (Math.floor(i * 0.08) === a && Math.floor(i * 0.1) === b) {
		result = i;
		break;
	}
}

console.log(result);
//  [typescript]
import * as fs from 'fs';
// main
function main(input: string[]) {
    // param
    let a: number = 0;
    let b: number = 0;
    let ans: number = 0;
    // init
    [a, b] = input.shift().split(" ").map(x => Number(x));
    // solve
    ans = -1;
    for (var rx = 0; rx <= 100; rx++) {
        if (a == Math.floor(rx * 0.08) &&
            b == Math.floor(rx * 0.10)) {
            ans = rx;
            break;
        }
    }
    // answer
    console.log(ans);
}
// entrypoint
function entrypoint() {
    try {
        // linux
        let input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            let input = lines;
            main(input);
        });
    }
}
entrypoint();
//  [typescript]
const main = (input: string) => {
  const [A, B] = input.trim().split(" ").map(str => parseInt(str))
  const taxRateA = 0.08
  const taxRateB = 0.1
  const maxCount = 1010
  let count = 1;
  let answer = -1;
  
  const taxRateCalc = (n: number) => {
    if(Math.floor(n * taxRateA) === A && Math.floor(n * taxRateB) === B) {
      return n
    } else {
      return -1
    }
  }

  while(answer === -1 || count < maxCount) {
    answer = taxRateCalc(count)
    count += 1
  }
  console.log(answer)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const main = (input: string) => {
  const [A, B] = input.trim().split(" ").map(str => parseInt(str))
  const taxRateA = 0.08
  const taxRateB = 0.1
  let count = 1;
  let answer = -1;
  
  const taxRateCalc = (n: number) => {
    if(Math.floor(n * taxRateA) === A && Math.floor(n * taxRateB) === B) {
      return n
    } else {
      return -1
    }
  }

  while(count <= 100 && answer === -1) {
    answer = taxRateCalc(count)
    count += 1
  }
  console.log(answer)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
n = int(input())
h = list(map(int, input().split()))

ans = 1

for i in range(1,len(h)):
  flag = 0
  for j in range(i):
    if h[i] < h[j]:
      flag = 1
  if flag == 0:
    ans += 1
    
print(ans)
//  [python]
n = int(input())
h = list(map(int, input().split()))

sum = 1

for i in range(1, n):
    flg = True
    for j in range(0, i):
        if h[i] < h[j]:
            flg = False
            break
    if flg:
        sum += 1

print(sum)
//  [python]
c = int(input())
H = input().split()

count = 1
for i in range(c-1):
  v = True
  for j in range(i+1):
    if int(H[i+1]) < int(H[j]):
      v = False
      break
  if v:
    count += 1
print(count)
//  [python]
N = int(input())
N_List = list(map(int,input().split()))
ans = 1
maxN = N_List[0]
for i in range(1,N):
    if N_List[i]>=maxN:
        ans += 1
    else:
        maxN = N_List[i]
print(ans)
//  [python]
import math


def main():
    n = int(input())
    # a, b = map(int, input().split())
    h = list(map(int, input().split()))
    # s = input()
    # h = [int(input()) for _ in rane(n)]

    count = 1
    maxi = h[0]
    for i in range(1, n):
        if h[i] > h[i-1] and h[i] >= maxi:
            count += 1
            maxi = h[i]
    print(count)


if __name__ == '__main__':
    main()
//  [python]
n=int(input())
h=list(map(int,input().split()))
kei = 1
m=0
for i in range(1,n):
    m = h[0]
    if m < h[i]:
        m = h[i]
    else:
        kei += 1

print(kei)
//  [java]
import java.io.DataInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		int N = in.i();
		int[] H = new int[N + 1];
		int cnt = 0;
		loop: for (int i = 1; i <= N; i++) {
			H[i] = in.i();

			for (int j = 1; j < i; j++)
				if (H[j] > H[i])
					continue loop;

			cnt++;
		}

		out.println(cnt);
	}


	static PrintStream out = System.out;
	static FastReader in = new FastReader();
}

class FastReader {
	final private int BUF_SIZE = 1 << 16;
	private DataInputStream din;
	private byte[] buffer = new byte[BUF_SIZE];
	private int bufferPointer, bytesRead;

	FastReader() {
		din = new DataInputStream(System.in);
	}

	String s() throws IOException {
		byte[] buf = new byte[64];
		int cnt = 0, c;
		while ((c = read()) != -1) {
			if (c == '\n') break;
			buf[cnt++] = (byte) c;
		}
		return new String(buf, 0, cnt);
	}

	int i() throws IOException {
		int ret = 0;
		byte c = read();
		while (c <= ' ') c = read();
		boolean neg = (c == '-');
		if (neg) c = read();
		do {
			ret = ret * 10 + c - '0';
		}
		while ((c = read()) >= '0' && c <= '9');
		return neg ? -ret : ret;
	}

	long l() throws IOException {
		long ret = 0;
		byte c = read();
		while (c <= ' ') c = read();
		boolean neg = (c == '-');
		if (neg) c = read();
		do {
			ret = ret * 10 + c - '0';
		}
		while ((c = read()) >= '0' && c <= '9');
		return neg ? -ret : ret;
	}

	double d() throws IOException {
		double ret = 0, div = 1;
		byte c = read();
		while (c <= ' ') c = read();
		boolean neg = (c == '-');
		if (neg) c = read();
		do {
			ret = ret * 10 + c - '0';
		}
		while ((c = read()) >= '0' && c <= '9');
		if (c == '.')
			while ((c = read()) >= '0' && c <= '9')
				ret += (c - '0') / (div *= 10);
		return neg ? -ret : ret;
	}

	private void fillBuffer() throws IOException {
		bytesRead = din.read(buffer, bufferPointer = 0, BUF_SIZE);
		if (bytesRead == -1) buffer[0] = -1;
	}

	private byte read() throws IOException {
		if (bufferPointer == bytesRead) fillBuffer();
		return buffer[bufferPointer++];
	}

	void close() throws IOException {
		if (din != null) din.close();
	}
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main  {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        int count = 1;
        StringTokenizer tokenizer = new StringTokenizer(input.readLine());
        int max = Integer.parseInt(tokenizer.nextToken());
        int value;
        for (int i = 1; i < n; i++) {
            value = Integer.parseInt(tokenizer.nextToken());
            if (value >= max)
                count++;

            max = Math.max(max, value);
        }
        System.out.println(count);
    }
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int max = 0;
		int ans = 0;
		for (int i = 0; i < N; i++) {
			int H = sc.nextInt();
			if (H >= max) {
				max = H;
				ans++;
			}
		}
		System.out.println(ans);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] a = new int[n];
		for(int i=n-1; i>=0; i--){
			a[i] = scn.nextInt();
		}
      	int count = 1;
      	for(int i=1; i<n; i++){
          if(a[i]>=a[i-1]){
            count++;
          }else break;
        }
      	System.out.println(count);
	}
}
//  [java]
import java.util.Scanner;

public class main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
Scanner SC = new Scanner(System.in);
int N = SC.nextInt();
int H [] = new int[N + 1];
for(int i = 0; i < N; i++) {
    H[i] = SC.nextInt();
}
int counter = 0;
for(int i = 0; i <= N; i++) {
	boolean cso = true;
	for(int j = 0; j <= N; i++) {
		if(H[j] > H[i]) {
			cso = false;
		}
	}
	if(cso) {
		counter++;
	}
}
System.out.println(counter);
	}

}
//  [java]
import java.util.Scanner;
public class Main{
  	public static void main (String [] args){
      	Scanner scanner = new Scanner (System.in);
      	int N = scanner.nextInt();
      	int [] arr = new int [N];
      	for (int i = 0; i < N; i++){
          	arr[i] = scanner.nextInt();
        }
      	int counter = 0;
      	for (int i = 1; i < N; i++){
          	if (arr[i-1] <= arr[i]) counter++;
        }
      	System.out.println(counter);
    }
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main() {
  int N; cin >> N;
  int visible,unvisible;
  vector<int> height(N);
  
  for( int i = 0; i < N; i++ )
    cin >> height.at(i);
  
  for( int i = 1; i < N + 1; i++ ) {
    for( int j = 1; j < i; j++ ) {
      unvisible = 0;
      if( height.at(i-1) < height.at(j-1) ) {
        unvisible++;
        break;
      }
    }
    if( unvisible == 0 )
      visible++;
  }
  cout << visible << endl;
}
//  [cpp]
#include <iostream>
using namespace std;

int main()
{
  int N;
  cin >> N;
  int H[N];
  for(int i=0;i<N;i++)
  {
    cin >> H[i];
  }

  bool judge;
  int total = 1;

  for(int i=1;i<N;i++)
  {
    for(int j=0;j<i;j++)
    {
      if(H[i]>=H[j])
      {
        judge = true;
      }
      else
      {
        judge = false;
        break;
      }
    }
    if(judge)total += 1;
  }

  cout << total << endl;

  return 0;
}
//  [cpp]
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;

int main() {
	int N;
	cin >> N;
	int S[30];
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}
	for (int i = 1; i < N; i++) {
		if (S[0] <= S[i]) {
			cnt++;
			S[0] = S[i];
		}
	}
	cout << cnt+1 << endl;
}
//  [cpp]
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
#define PI 3.1415926535897932384626433832795
#define coutfix(i) cout << fixed << setprecision(i)
using namespace std;

int main()
{
	int64 nn, ans = 0;
	cin >> nn;
	vector<int64> hh(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> hh[ii];
	}
	for(int64 ii = 1;ii < nn;ii++)
	{
		if(hh[ii - 1] <= hh[ii])
		{
			ans++;
		}
		else
		{
			hh[ii] = hh[ii - 1];
		}
	}
	cout << ans << endl;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)

int main(){
    int n,m=0,ans=0;
    int h[n];
    sc1(n);
    rep(i,n) sc1(h[i]);
    rep(i,n) {
        if (h[i]>=m) {
            m=h[i];
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

int lcm(int a,int b) { return a*b/__gcd(a,b); }
//long long lcm(ll a,ll b) { return a*b/__gcd(a,b); }

/**
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 **/


int main(){
    int mod=1000000007;
    int n,m=0,ans=0;
    int h[n];
    sc1(n);
    rep(i,n) sc1(h[i]);
    rep(i,n) {
        if (h[i]>=m) {
            m=h[i];
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}
//  [c]
#include<stdio.h>
int main(){
  int N,i,k=1,hight=0;
  int a[200]={};
  scanf("%d",&N);
  for(i=0;i<N;i++){
  scanf("%d",&a[i]);
  }
  //printf("%d\n",N);
  //printf("%d\n",a[1]);
  hight=a[0];
    for(i=1;i<N;i++){
      if(hight<=a[i]){
        hight=a[i];
        k=k+1;
      }
    }
  printf("%d",k);
  return 0;
}
//  [c]
#include<stdio.h>
int main(){
    int n, i = 0;
    scanf("%d",&n);
    int h[n];
    int ans = 1;
    for(; i < n; i++)
        scanf("%d",&h[i]);
    for(i = 1; i < n; i++){
        int f = 1;
        for(int j = 0; j < i; j++){
            if(h[j] > h[i]){
                f = 0;
                break;
            }
        }
        if(f)
            ans ++;
    }
    printf("%d\n",ans);
    return 0;
}
//  [c]
#include<stdio.h>

int main(){
    int input_num;
    int num[100];
    int i, j;
    int ans =1;

    scanf("%d", &input_num);

    for(i=0; i<input_num; i++){
        scanf("%d", &num[i]);
    }

    for(i=1; i<input_num; i++){
        for(j=0; j<i; j++){
            if(num[j] > num[i]){
                break;
            }
        }
        if(i == j){
            ans += 1;
        }
    }
    printf("%d", ans);
    return 0;
}
//  [c]
#include<stdio.h>

int main()
{
    int N,i,j,count=1;
    scanf("%d", &N);
    int H[N];
    for(i=0; i<N; i++)
        scanf("%d", &H[i]);
    for(j=1; j<N; j++)
    {
        if((H[j]>=H[0]) && (H[j]>=H[1]) && (H[j]>=H[j-1]))
            count++;
    }

    printf("%d\n", count);

    return 0;

}
//  [c]
#include<stdio.h>

int main()
{
    int N,i,j,count=0;
    scanf("%d", &N);
    int H[N];
    for(i=0; i<N; i++)
        scanf("%d", &H[i]);
    for(j=1; j<N; j++)
    {
        if(H[j]>=H[j-1] && H[j]>=H[0] && H[j]>=H[1])
            count++;
    }

    printf("%d\n", count+1);

    return 0;

}
//  [c]
#include<stdio.h>

int main()
{
    int N,i,j,count=0;
    scanf("%d", &N);
    int H[N];
    for(i=0; i<N; i++)
        scanf("%d", &H[i]);
    for(j=1; j<N; j++)
    {
        if(H[j]>H[j-1])
            count++;
    }
    
    printf("%d", count+1);
    
    return 0;
        
}
//  [javascript]
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0], 10);
  input = input[1].split(" ");
  var ans = 0;
  var flg = 0;
  for (var i = 0; i < n; i++) {
    flg = 0;
    if (i == 0) {
      ans++;
    } else {
      for(var j = 0; j < i; j++) {
        if (parseInt(input[i], 10) < parseInt(input[j], 10)){
          flg = 1;
          break;
        }
      }
      if(flg == 0) {
        ans++;
      }
    }
  }
  console.log('%d',ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  var lfArgs = input.split('\n');
  var n = parseInt(lfArgs[0]);
  var hs = lfArgs[1].split(' ');
  var max = parseInt(hs[0]);
  var count = 1;
  for (var i = 1; i < n; i++) {
    if (max <= parseInt(hs[i])) {
      max = hs[i];
      count++;
    }
  }
  console.log(count);


}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
  	var heights = input[1].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
    var max = 0;
  	var count = 0;
  	
  	heights.forEach((val) => {
      var h = parseInt(val);
      if (h >= max) {
        count++;
        max = h;
      }
    });
	//出力
	console.log(count);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
const Main = (input) =>{
    let xs = input.trim().split('\n');
    let nums = xs[1].trim().split(' ').map(v=>parseInt(v,10));
    const compare = (a, b)=>{ //関数名は何でもOK
　　return a - b;  //a - b 昇順 b - a 降順
　　}
    let ans = nums.sort(compare); 
    //console.log(ans);
    let count = 1;
    for(let i =0; i<xs[0]; i++){
        if(ans[i]<ans[i+1]){
        count++
        }else{
        count += 0
        }
    }
    console.log(count);




}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [javascript]
"use strict";
const Main = (input) =>{
    let xs = input.trim().split('\n');
    let nums = xs[1].trim().split(' ').map(v=>parseInt(v,10));
    let count = 1;
    for(let i =0; i<xs[0]; i++){
        if(nums[0]<=nums[i+1]){
        count++
        }else{
        count += 0
        }
    }
    console.log(count);




}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [javascript]
"use strict";
const Main = (input) =>{
    let xs = input.trim().split('\n');
    let nums = xs[1].trim().split(' ').map(v=>parseInt(v,10));
    let count = 1;
    for(let i =0; i<xs[0]; i++){
        if(nums[i]<=nums[i+1]){
        count++
        }else{
        count += 0
        }
    }
    console.log(count);




}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [go]
package main

import "fmt"

func main() {
	var N int
	fmt.Scanf("%d", &N)
	H := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &H[i])
	}
	count := 1
	max := H[0]
	for i := 1; i < N; i++ {
		if max <= H[i] {
			count++
		}
		if max < H[i] {
			max = H[i]
		}
	}
	fmt.Println(count)
}
//  [go]
package main

import(
	"fmt"
)

func main() {
	var n int
  	fmt.Scan(&n)
  	
  	heights := make([]int,n)
  	
  	for i := 0; i < n; i++ {
  		fmt.Scan(&heights[i])
  	}
  	
  	hotelCnt := 1;
  	for tag := 1; tag < n; tag++ {
      	cnt := 0
  		for j := 0; j < tag; j++ {
  			if heights[tag] < heights[j] {
  				break
  			} else {
              	cnt++		
  			}
  		}
  		if tag == cnt {
	  		hotelCnt++
	  	}
  	}
  	fmt.Println(hotelCnt)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)


func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	h := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		h[i], _ = strconv.Atoi(sc.Text())
	}

	ans := 1
	max := 0
	for i := 1; i < n;i++ {
		if h[i] < h[i-1] {
			continue
		}
		ans++

		if max < h[i] {
			max = h[i]
		}
	}

	fmt.Println(ans)

}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	hs := make([]int, n)
	for i := range hs {
		fmt.Scan(&hs[i])
	}

	var count int
	if n == 1 {
		count = 1
	} else {
		for i := 1; i < n; i++ {
			if f(hs, i) {
				count++
			}
		}
	}

	fmt.Print(count)
}

func f(hs []int, idx int) bool {
	h := hs[idx]
	for i := 0; i < idx; i++ {
		if h < hs[i] {
			return false
		}
	}
	return true
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var s = bufio.NewScanner(os.Stdin)

func getInt() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func main() {
	s.Split(bufio.ScanWords)
	n := getInt()

	h := make([]int, n)
	for i := 0; i < n; i++ {
		h[i] = getInt()
	}
	fmt.Println(h)
	count := 0
	ans := 0
	for i := 1; i < n; i++ {
		for j := 0; j < i; j++ {
			if h[i] >= h[j] {

			} else {
				count++
				break
			}
		}
		if count == 0 {
			ans++
		}
		count = 0
	}
	fmt.Println(ans + 1)
}
//  [ruby]
# b
n = gets.to_i
h = gets.split.map(&:to_i)
m = h[0]

cnt = 0
h.each do |hh|
  if hh >= m
    cnt += 1
    m = hh
  end
end
p cnt
//  [ruby]
n = gets.to_i
h = gets.chomp.split.map(&:to_i)
res = 1
top = h[0]
(1...n).each do |i|
  res += 1 if top <= h[i]
  top = h[i] if h[i] > top
end
puts res
//  [ruby]
# frozen_string_literal: true

_ = gets
h = gets.split.map(&:to_i)
max = h[0]
count = 1

h[1..-1].each do |e|
  if e >= max
    count += 1
    max = e
  end
end

puts count
//  [ruby]
n = gets.to_i
h = gets.split.map(&:to_i)
 
count = 1
(1..n-1).each do |i|
  if h[0] <= h[i] && h[i-1] <= h[i]
    count += 1
  end
end
puts count
//  [ruby]
n = gets.to_i
h = gets.split.map(&:to_i)

count = 1
(1..n-1).each do |i|
  if h[0] < h[i] && h[i-1] < h[i]
    count += 1
  end
end
puts count
//  [ruby]
n = gets.chomp.to_i
h = gets.chomp.split(' ').map(&:to_i)
max = -1
count = 0

h.each do |takasa|
  if (takasa > max)
    count += 1
    max = takasa
  end
end
puts count
//  [rust]
// Your code here!

use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main(){
    let n: usize = read();
    let hs: Vec<i32> = read_vec();
    
    let mut cnt:i32 = 0;
    let mut mx:i32 = 0;
    
    for i in 0..n{
        if mx<=hs[i]{
            cnt+=1;
            mx=hs[i];
        }
    }
    println!("{}",cnt)
    
    
}
//  [rust]
#![allow(dead_code, unused_variables, unused_macros, unused_imports)]

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input! {
        n: usize,
        h: [i32; n],
    }

    let mut ans = 0;
    h.iter().fold(0, |highest, &h| {
        if h >= highest {
            ans += 1;
        }
        std::cmp::max(h, highest)
    });
    println!("{}", ans);
}
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n:i32 = v[0];
	let v:Vec<i32> = procon_read();
	let h:Vec<i32> = v.clone();
	let mut cnt = 1;
	for i in 1..n {
		cnt += 1;
		for j in 0..i {
			if h[i as usize]  < h[j as usize] {
				cnt += -1;
				break;
			}
		}
	}
	println!("{}", cnt);
}
//  [rust]
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:usize,
    b:[isize;a],
    }
    let mut ans:isize=1;
    for i in 1..a {
        if b[0]<=b[i]&&b[1]<=b[i]&&b[i-1]<=b[i] {ans+=1;}
    }
    println!("{}",ans);
}
//  [rust]
use proconio::input;
use std::cmp::*;

fn main() {
    input! {
        n: usize,
        h: [u64;n],
    }

    let ans = h
        .iter()
        .zip(h.iter().scan(0, |m, &now| {
            *m = max(*m, now);
            Some(now >= *m)
        }))
        .filter(|(_, x)| *x)
        .count();

    println!("{}", ans);
}
//  [rust]
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }

use std::cmp::*;

fn main() {
    input! {
        n: usize,
        h: [u64;n],
    }

    let ans = h
        .iter()
        .zip(h.iter().scan(0, |m, &now| {
            *m = max(*m, now);
            Some(now >= *m)
        }))
        .filter(|(_, x)| *x)
        .count();

    println!("{}", ans);
}
//  [swift]
var _=readLine(),H=readLine()!.characters.split(" ").map{Int(String($0))!},h=0,a=0;H.forEach{if $0>=h{a++;h=$0}};print(a)
//  [swift]
var _=readLine()!,H=readLine()!.characters.split(" ").map{Int(String($0))!},h=0,a=0;for i in H{if i>=h{a++;h=i}};print(a)
//  [swift]
var n: Int = Int(readLine()!)!
var arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
var highest: Int = 0
var o: Int = 0

for var i = 0; i < n; i++ {
  if( highest <= arr[i] ) {
    highest = arr[i]
    o+=1
  } 
}
print (o)
//  [swift]
var _=readLine(),H=readLine()!.characters.split(" ").map{String($0)},h="0",a=0;for i in H{if i>=h{a++;h=i}};print(a)
//  [swift]
var _=readLine()!,H=readLine()!.characters.split(" ").map{String($0)},h="0",a=0;for i in H{if i>=h{a++;h=i}};print(a)
//  [swift]
let H=readLine()!.characters.split(" ").map{Int(String($0))!};
var h=0,a=0;
for i in H{
  if i>=h{
    a++;
    h=i
  }
};
print(a)
//  [typescript]
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let n=t.n()
  let an=t.n(n)
  let max=an[0],c=1
  for(let i=1;i<n;i++){
    if(max<=an[i]){
      c++
      max=an[i]
    }
  }
  t.o(c)
}
main()
//  [typescript]
function Main(input) {
  const lines = input.trim().split("\n");
  const N = parseInt(lines[0]);
  const H = lines[1].split(" ").map(h => parseInt(h));
  let ans = 0;
  H.forEach((h, i) => {
    let canSeeOcean = true;
    for (let j = 0; j < i; j++) {
      if (h < H[j]) {
        canSeeOcean = false;
      }
    }
    if (canSeeOcean) {
      ans++;
    }
  });
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]

const solve = (hs) => {
  // ...
  let currMax = 0
  let result = 0
  hs.map((h) => {
    if (h >= currMax) {
      result++
    }
    currMax = Math.max(h, currMax)
  })
  return result
}
const main = (input) => {
  const [n, hs] = input.split("\n")
  return solve(hs.split(" ").map(Number))
}

if (process.env.NODE_ENV !== "test") {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(main(input.trim()))
}
//  [typescript]
const main = (input: string) => {
  const lines = input.split("\n");
  const H = lines[1].split(" ").map(str => parseInt(str));
  let answer = 0;

  H.forEach((h, i) => {
    if (i === 0 || (H[i - 1] <= h && H[0] <= h)) {
      answer += 1;
    }
  });

  console.log(answer);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const main = (input: string) => {
  const lines = input.split("\n");
  const H = lines[1].split(" ").map(str => parseInt(str));
  let answer = 0;

  H.forEach((h, i) => {
    if (i === 0 || (H[i - 1] < h && H[0] <= h)) {
      answer += 1;
    }
  });

  console.log(answer);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf8").split("\n")[1];

const heights = input.split(" ");
let currH = heights[0];
return currH;
//  [python]
N = int(input())
S = str(input())
X = [0] * N

Sum1 = 0
Sum2 = 0
Sum3 = 0

for i in range(N):
    if S[i] == "R":
        X[i] = 1
        Sum1 += 1
    elif S[i] == "G":
        X[i] = 2
        Sum2 += 1
    elif S[i] == "B":
        X[i] = 4
        Sum3 += 1

Sum = Sum1 * Sum2 * Sum3

for i in range(N):
    for j in range(1, N):
        if i - j < 0 or N <= i + j:
            break
        else:
            if (X[i] + X[i - j] + X[i + j]) == 7:
                Sum -= 1

print(Sum)
//  [python]
# https://atcoder.jp/contests/abc162/submissions/11837869
# tamazooさんを参考に書いた
n = int(input())
s = input()
x = [0] * n
num_r, num_g, num_b = 0, 0, 0
for i in range(n):
    if s[i] == 'R':
        x[i] = 1
        num_r += 1
    elif s[i] == 'G':
        x[i] = 2
        num_g += 1
    elif s[i] == 'B':
        x[i] = 4
        num_b += 1

num = num_r * num_g * num_b

for i in range(n):
    for j in range(1, n):
        if i - j < 0 or n <= i + j:
            break
        else:
            if (x[i - j] + x[i] + x[i + j]) == 7:
                num -= 1
print(num)
//  [python]
D = {"R": 1, "G": 2, "B": 4}
E = {"R": 0, "G": 1, "B": 2}
N = int(input())
T = [E[a] for a in input()]
S = [1 << t for t in T]
s = 0
for i in range(N):
    for j in range(1, min(i+1, N-i)):
        if S[i] + S[i-j] + S[i+j] == 7: s += 1

X = [[0] * N for _ in range(3)]

for i, t in enumerate(T):
    X[t][i] += 1

for i in range(3):
    for j in range(1, N):
        X[i][j] += X[i][j-1]

ans = -s
for i in range(N):
    if T[i] == 0:
        ans += X[1][i] * (X[2][-1] - X[2][i]) + X[2][i] * (X[1][-1] - X[1][i])
    if T[i] == 1:
        ans += X[2][i] * (X[0][-1] - X[0][i]) + X[0][i] * (X[2][-1] - X[2][i])
    if T[i] == 2:
        ans += X[0][i] * (X[1][-1] - X[1][i]) + X[1][i] * (X[0][-1] - X[0][i])
print(ans)
//  [python]
N=int(input())
S=input()
R=[];G=[];B=[]
for i in range(N):
  if S[i]=='R':R.append(i)
  elif S[i]=='G':G.append(i)
  else:B.append(i)
s=len(R)*len(G)*len(B)
RG= [(x+y)/2 for x in R for y in G]
GB= [(x+y)/2 for x in G for y in B]
BR= [(x+y)/2 for x in B for y in R]

for i in RG:
  if i in B:s-=1
for i in GB:
  if i in R:s-=1
for i in BR:
  if i in G:s-=1
print(s);exit()

print(R,G,RG)
exit()
s=len(R)*len(G)*len(B)
for i in R:
  for j in G:
    if (i+j)/2 in B:s-=1
for i in G:
  for j in B:
    if (i+j)/2 in R:s-=1
for i in B:
  for j in R:
    if (i+j)/2 in G:s-=1

print(s)
//  [python]
N=int(input())
S=input()
R=[];G=[];B=[]
for i in range(N):
  if S[i]=='R':R.append(i)
  elif S[i]=='G':G.append(i)
  else:B.append(i)
#print(len(R),len(G),len(B))
s=len(R)*len(G)*len(B)
for i in R:
  for j in G:
    if (i+j)/2 in B:s-=1
for i in G:
  for j in B:
    if (i+j)/2 in R:s-=1
for i in B:
  for j in R:
    if (i+j)/2 in G:s-=1

print(s)
//  [python]
N=int(input())
S=input()
R=[];G=[];B=[]
for i in range(N):
  if S[i]=='R':R.append(i)
  elif S[i]=='G':G.append(i)
  else:B.append(i)

s=0
for i in range(len(R)):
  for j in range(len(G)):
    for k in range(len(B)):
#      print(i,j,k)
#      print(max(R[i],G[j],B[k])+min(R[i],G[j],B[k]),R[i]+G[j]+B[k])
      if (max(R[i],G[j],B[k])+min(R[i],G[j],B[k]))*3/2==R[i]+G[j]+B[k]:continue
      s+=1

print(s)
//  [java]
import java.util.*;
import java.io.*;

public class Main {
 
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
	    int n = in.readInt();
	    char s[] = in.readString().toCharArray();
	    long r = 0, g = 0, b = 0; 
	    
	    for(int i = 0; i<n; i++) {
	    	if(s[i] == 'R') r++; 
	    	if(s[i] == 'G') g++; 
	    	if(s[i] == 'B') b++; 
	    }
	    long total = r*g*b; 
	    int ans = 0; 
	    int rgb = (int)'R' + (int)'G' + (int)'B'; 
	    for(int i = 0; i<n; i++) {
	    	for(int j = i+1; j<n; j++) {
	    		int k = 2*j - i; 
	    		if(k < n) 
	    			if((int)s[i] + (int)s[j] + (int)s[k] == rgb) 
	    				total--;  
	    	}
	    }
	    System.out.println(total); 
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        String s = fs.next();
        long r=0, b=0, g=0;
        for(char c : s.toCharArray()){
            if(c == 'R') r++;
            else if(c == 'B') b++;
            else g++;
        }
        long total = r*b*g;
        int rgb = (int) 'R' + (int) 'B' + (int) 'G';
        for(int i=0; i<n; ++i){
            char si = s.charAt(i);
            for(int j=i+1; j<n; ++j){
                char sj = s.charAt(j);
                int k = j + (j-i);
                if(k < n){
                    if(((int) si + (int) sj + (int) s.charAt(k)) == rgb)
                        total--;
                }
            }
        }
        System.out.println(total);
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int N = fs.nextInt();
        String s = fs.next();
        int len = s.length();
        int r = 0;
        int g = 0;
        int b = 0;

        for (int i = 0; i < len; ++i) {
            if (s.charAt(i) == 'R') {
                ++r;
            } else if (s.charAt(i) == 'G') {
                ++g;
            } else {
                ++b;
            }
        }

        long ans = r*b*g;
        for (int i = 0; i <= len-3; ++i) {
            for (int j = i+1; j < len-1; ++j) {
                if (s.charAt(i) == s.charAt(j)) continue;
                if (j+j-i < len && s.charAt(j+j-i) != s.charAt(i)
                    && s.charAt(j+j-i) != s.charAt(j)) --ans;
            }
        }

        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}

    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() { return Double.parseDouble(next());}
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int N = fs.nextInt();
        String s = fs.next();
        int len = s.length();
        int r = 0;
        int g = 0;
        int b = 0;

        for (int i = 0; i < len; ++i) {
            if (s.charAt(i) == 'R') {
                ++r;
            } else if (s.charAt(i) == 'G') {
                ++g;
            } else {
                ++b;
            }
        }

        int ans = r*b*g;
        for (int i = 0; i <= len-3; ++i) {
            for (int j = i+1; j < len-1; ++j) {
                if (s.charAt(i) == s.charAt(j)) continue;
                if (j+j-i < len && s.charAt(j+j-i) != s.charAt(i)
                    && s.charAt(j+j-i) != s.charAt(j)) --ans;
            }
        }

        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}

    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() { return Double.parseDouble(next());}
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int[] ch = new int[n];
        int r = 0;
        int g = 0;
        int b = 0;
        for(int i = 0; i < n ;i++){
            ch[i] = s.charAt(i);
            if(ch[i] == 'R'){
              r++;
            }else if(ch[i] == 'G'){
              g++;
            }else{
              b++;
            }
        }
        long ans = r * g * b;
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
              int k = j + j - i;
              if(k < n && ch[i] != ch[j] && ch[i] != ch[k] && ch[j] != ch[k]){
                ans--;
              }
            }
          }
          System.out.println(ans);
    }
}