//  ACPC ISA.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ld long double
#define ll long long
#define ull unsigned long long
#define pb push_back
#define eb emplace_back
#define endl '\n'
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<typename A, typename B>
string to_string(pair<A, B> p);

template<typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template<typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string) s); }

string to_string(bool b) { return (b ? "true" : "false"); }

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first)res += ", ";
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template<size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++)res += static_cast<char>('0' + v[i]);
  return res;
}

template<typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first)res += ", ";
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template<typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }

template<typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template<typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " +
         to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define err(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define err(...) 42
#endif
ll const N = 1e5 * 2, NN = 1e5 * 2 + 2, mod = 1e9 + 7;

void task_a() {
  string s;
  cin >> s;
  deque<char> dq;
  int cnt = 0;
  for (int i = 0; i < s.length(); ++i) {
    if(s[i]=='R') {
      cnt++;
      continue;
    }
    if (cnt % 2 == 0) {
      if (dq.empty())dq.pb(s[i]);
      else {
        if (dq.back() == s[i]) {
          dq.pop_back();
        } else {
          dq.pb(s[i]);
        }
      }
    } else {
      if (dq.empty())dq.push_front(s[i]);
      else {
        if (dq.front() == s[i]) {
          dq.pop_front();
        } else {
          dq.push_front(s[i]);
        }
      }
    }
  }
  if (cnt % 2 == 0) {
    while (!dq.empty()) {
      cout << dq.front();
      dq.pop_front();
    }
  } else {
    while (!dq.empty()) {
      cout << dq.back();
      dq.pop_back();
    }
  }
}


void task_b() {

}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  // cin >> t;
  for (int i = 1; i <= t; ++i) {
    task_a();
    // task_b();
  }
  return 0;
}
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>
#include<map>
#include<cassert>

using namespace std;

#define ll long long
#define reps(i, a, b) for(int i = a; i < b; i++)
#define rreps(i, a, b) for(int i = a-1; i >= b; i--)
#define rep(i, n) reps(i, 0, n)
#define rrep(i, n) rreps(i, n, 0)
#define P pair<int, int>

const ll mod = 1000000007;
const int INF = 1001001001;


ll N;
vector<pair<ll, ll> > prime; 

void prime_fact(ll x){
    for (ll i = 2; i * i <= x; i++){
        if(x % i == 0){
            pair<ll, ll> p = make_pair(i, 0);
            while (x % i == 0){
                x /= i;
                p.second++;
            }
            prime.push_back(p);
        }
    }
    if(x > 1){
        pair<ll, ll> p = make_pair(x, 1);
        prime.push_back(p);
    }
}

int ans = 0;

void f(ll n, int num){
    if(num == prime.size()){
        // cout << n << endl;
        ll x = (2 * N) / n;
        if((x - ( n - 1)) % 2 == 0) ans++;
        return;
    }
    ll a = 1;
    rep(i, prime[num].second+1){
        f(n*a, num+1);
        a *= prime[num].first;
    }
}

int main(){
    cin >> N;
    prime_fact(2*N);
    f(1, 0);
    cout << ans << endl;
}