#include #include #include #include using namespace std; int *file_vector; int main() { string file; long long file_length = 0; long long moznosti = 0; cin >> file_length; if(file_length < 1){ cout << 0; return 0; } cin >> file; // file = "XXXXXOOOOXXXXXXXX";// // file_length = file.size(); // cout << "file length" << file_length << "\n"; // if(nanic != file_length){ // cout << 0; // return 0; // } vector v; for(int x = 0; x < file_length; x++){ char pismeno = file[x]; if(pismeno == 'X'){ v.push_back(1); } else { v.push_back(0); } } for(int strana_a = 3; strana_a <= sqrt(file_length); strana_a++){ // cout << "strana: " << strana_a <<" \n"; int celkovy_obsah = pow(strana_a,2); // cout << "celkovz obsah" << celkovy_obsah << "\n"; int vnutorny_obsah = (strana_a - 2) * (strana_a - 2); //pow(strana_a - 2, 2); // cout << "vnutorny obsah" << vnutorny_obsah << "\n"; // for(int i = 0; i <= file_length - pow(strana_a,2) ;i++){ // cout << "zaci atok iteracie index: " << i <<" \n"; int pocetx = 0; int poceto = 0; for(int x = i; x < i + pow(strana_a, 2); x++){ // cout << "index: " << x <<" \n"; if(v[x] == 0){ poceto++; } else { pocetx++; } if(poceto == vnutorny_obsah && pocetx == celkovy_obsah - vnutorny_obsah){ // cout << "spravna\n"; moznosti++; } } } }; cout << moznosti ; return 0; }