#include<bits/stdc++.h>
#define int long long
#define zmrl(x) (int)((x).size())
#define ahen(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii = pair<int,int>;
const int N = 10000000000LL;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n; cin>>n;
    char A[200200]; cin>>(A+1);
    int res = 0;
    bool yes = true;
    int cur = 0;
    int th = 1;
    for (int i=1; i<=n&&yes; i++) {
        if (!cur) {
            if (A[i]=='1') {
                cur=1;
            }
            else yes=false;
        }
        else if (cur==1) {
            if (A[i]=='1') {
                cur=2;
            }
            else yes=false;
        }
        else {
            if (A[i]=='0') {
                cur=0;
                if (i<n) th++;
            }
            else yes=false;
        }
    }
    if (yes) {
        res += N-th+1;
    }
    cur = 1;
    yes = true;
    for (int i=1; i<=n&&yes; i++) {
        if (!cur) {
            if (A[i]=='1') {
                cur=1;
            }
            else yes=false;
        }
        else if (cur==1) {
            if (A[i]=='1') {
                cur=2;
            }
            else yes=false;
        }
        else {
            if (A[i]=='0') {
                cur=0;
                if (i<n) th++;
            }
            else yes=false;
        }
    }
    if (yes) {
        res += N-th+1;
    }
    cur = 2;
    yes = true;
    for (int i=1; i<=n&&yes; i++) {
        if (!cur) {
            if (A[i]=='1') {
                cur=1;
            }
            else yes=false;
        }
        else if (cur==1) {
            if (A[i]=='1') {
                cur=2;
            }
            else yes=false;
        }
        else {
            if (A[i]=='0') {
                cur=0;
                if (i<n) th++;
            }
            else yes=false;
        }
    }
    if (yes) {
        res += N-th+1;
    }
    cout<<res<<'\n';
    return 0;
}
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0() {}
template<typename H,typename... T> void print0(H h,T... t){cout<<fixed<<setprecision(15)<<h;print0(t...);}
void print() { print0("\n"); }
template<typename H,typename... T>void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);}
void ioinit() { cout << fixed << setprecision(15); ios_base::sync_with_stdio(0); cin.tie(0); }
// clang-format on

int main() {
    string s;
    cin >> s;
    ll ans = 0;
    for (ll i = 0; i <= 9999; i++) {
        string t = to_string(i);
        vector<bool> exist(10);
        for (auto c : t) {
            ll n = c - '0';
            exist[n] = true;
        }
        if (i < 1000) {
            exist[0] = true;
        }

        bool ok = true;
        for (ll d = 0; d <= 9; d++) {
            if (s[d] == 'o' && !exist[d]) ok = false;
            if (s[d] == 'x' && exist[d]) ok = false;
        }
        if (ok) {
            ans++;
        }
    }
    print(ans);
}
