#include using namespace std; typedef unsigned long long ull; typedef long long ll; typedef string str; const ll mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); str s; int n, countt = 0; cin >> n >> s; for (int i = 0; i < n; i++) { int l = i, r = i; while (l >= 0 && r < n && s[l] == s[r]) { countt++; l--; r++; } l = i, r = i + 1; while (l >= 0 && r < n && s[l] == s[r]) { countt++; l--; r++; } } cout << countt; return 0; }