import java.util.ArrayList;
import java.util.Scanner;

public class Patio {

    public static int COUNT = 0;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        scanner.nextLine();
        String line = scanner.nextLine();

        ArrayList<Blok> bloky = new ArrayList<>();
        int help = 3;
        int max = 8;
        while (help*help < n) {
            bloky.add(new Blok(help*help, max, (help*help) - max, line));
            help ++;
            max += 4;
        }

        help = 9;
        while (help < line.length()) {
            for (int i = 0; i < bloky.size(); i++) {
                if (bloky.get(i).end < help) {
                    bloky.get(i).move(line.charAt(bloky.get(i).start),line.charAt(help));
                } else {
                    break;
                }
            }
            help++;
        }

        System.out.println(COUNT);


    }

    public static class Blok {
        int start;
        int end;
        int size;
        int max;
        int min;
        int x;
        int o;

        public Blok( int size, int max, int min, String line) {
            this.start = 0;
            this.end = size - 1;
            this.size = size;
            this.max = max;
            this.min = min;

            this.x = 0;
            this.o = 0;
            for (int i = 0; i < size; i++) {
                if (line.charAt(i) == 'X') {
                    x++;
                } else {
                    o++;
                }
            }

            if (x == max || o == max) {
                COUNT++;
            }
        }

        public void move(char prev, char curr) {
            if (prev != curr) {
                if (curr == 'X') {
                    x++;
                    o--;
                } else {
                    x--;
                    o++;
                }
            }

            start++;
            end++;

            if (x == max || o == max) {
                COUNT++;
            }
        }
    }
}
