#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pai
#include <vector>        // vector

typedef long long ll;

using namespace std;

// イテレーション
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define repk(i, k, n) for (ll i = k; i < ll(n); i++)

// x:コンテナ
#define ALL(vec) vec.begin(), vec.end()
#define SIZE(x) ll(x.size())

#define debug(x) cout << "debug: " << x << endl

// 定数
#define MOD 1000000007
#define INF32 2147483647
#define INF64 9223372036854775807

int digitsum(int n) {
  int ans = 0;
  while (n > 0) {
    ans += n % 10;
    n /= 10;
  }
  return ans;
}
void DoSomething() {
  //
  int a, b;
  cin >> a >> b;
  int sum_a = digitsum(a);
  int sum_b = digitsum(b);
  cout << max(sum_a, sum_b) << "\n";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  DoSomething();

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mem(a,val) memset(a,(val),sizeof((a)))
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define decimal(n)  cout << fixed ; cout << setprecision((n));
#define mp make_pair
#define eb emplace_back
#define f first 
#define s second
#define all(v) v.begin(), v.end()
#define endl "\n"
#define lcm(m,n) (m)*((n)/__gcd((m),(n)))
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(ll (i)=1;(i)<(n);(i)++)
#define repa(i,n,a) for(ll (i)=(a);(i)<(n);(i)++)
#define repr(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sz(x) (ll)x.size()
#define ub upper_bound
#define lb lower_bound
#define pcnt(x) __builtin_popcountll(x)
const long long N=1e4+10;
const long long NN=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;
template<typename T,typename T1>T maxn(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T minn(T &a,T1 b){if(b<a)a=b;return a;}
 
 
ll abc[61];
void pre()
{
  abc[0]=1;
  for(int i=1;i<=60;i++)
  {
    abc[i]=abc[i-1]*2;
  }
}
 
void solve()
{
  //code begins from here//
  ll n;
  cin>>n;
  string s[n+1];
  rep1(i,n+1)cin>>s[i];
  ll ans=0;
  for(int i=n;i>=1;i--)
  {
    if(s[i]=="OR")
    {
      ans+=abc[i];
    }
  }
  ans++;
  cout<<ans;
}
 
signed main()
{
FAST
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int testcase=1;
//cin>>testcase;
  pre();
while(testcase--) solve();
return 0;
}