#include using namespace std; using namespace chrono; #if __has_include() #include using namespace atcoder; #endif int main() { int n; string s; cin >> n >> s; set> st; int ans = 0; for (int i = 0; i + 1 < n; i++) { if (s[i] == 'A' && s[i + 1] == 'A') { if (st.find({i, i + 1}) == st.end()) { ans++; st.emplace(i, i + 1); } } else if (s[i] == 'A') { if (st.find({i, -1}) == st.end()) { ans++; st.emplace(i, -1); } } else if (s[i + 1] == 'A') { if (st.find({i + 1, -1}) == st.end()) { ans++; st.emplace(i + 1, -1); } } else { if (st.find({-1, -1}) == st.end()) { ans++; st.emplace(-1, -1); } } } cout << ans << endl; return 0; }