#include <bits/stdc++.h>   using namespace std;   int n, rsp, ans, taram;   char first;   int main() {     cin >> n;     cin >> first;     if (first ==  U ) {       taram = 2;       rsp++;     } else       taram = 1;     for (int i = 2; i <= n; i++) {       cin >> first;       if (rsp * 2 == i - 1) {         ans += (first ==  R  && taram == 2);         ans += (first ==  U  && taram == 1);         if ((first ==  R  && taram == 2) || (first ==  U  && taram == 1))           taram = taram % 2 + 1;       }       if (first ==  U ) rsp++;     }     cout << ans;     return 0;   }   