#include <bits/stdc++.h>
using namespace std;

int n;
string s;
int ans;
int t;

int main() {
    cin >> s;
   for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'o') {
            t++;        
        }
   } 
   if (t > 4) {
    cout << 0 << endl;
    return 0;
   }
   for (int a = 0; a <= 9; a++) {
        for (int b = 0; b <= 9; b++) {
            for (int c = 0; c <= 9; c++) {
                for (int d = 0; d <= 9; d++) {
                    int r[15];
                    memset(r, 0, sizeof(r));
                    if (s[a] == 'o') {
                        r[a] = 1;                    
                    }
                    if (s[b] == 'o') {
                        r[b] = 1;
                    }
                    if (s[c] == 'o') {
                        r[c] = 1;
                    }
                    if (s[d] == 'o') {
                        r[d] = 1;
                    }
                    int f = 0;
                    for (int i = 0; i <= 9; i++) {
                        if (s[i] == 'o') {
                            if (r[i] == 0) {
                                f = 1;
                                break;
                            }
                        }
                    }
                    if (f == 1) {
                        continue;
                    }
                    if ((s[a] == 'o' || s[a] == '?') && (s[b] == 'o' || s[b] == '?') && (s[c] == 'o' || s[c] == '?') && (s[d] == 'o' || s[d] == '?')) {
                        ans++;
                    }
                }
            }
        }
   }
    cout << ans << endl;
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
  
  int N;
  char s[200001];
  
  int cnt = 0;
  char ptr[4] = "110";
  char p[200010];
  
  int flag = 0;
  
  long long ans = 0;
  
  scanf("%d", &N);
  scanf("%s", s);
  
  for(int k = 0;k < (N + 2)/ 3 + 1;k++){
    memcpy(p + k * 3, ptr, 3);
  }
  p[N + 2] = '\0';
  if(!strcmp(p + 2, s))flag = 1;
  p[N + 1] = '\0';
  if(!flag && !strcmp(p + 1, s))flag = 2;
  p[N] = '\0';
  if(!flag && !strcmp(p, s))flag = 3;
  
  if(N == 1){
    if(s[0] == '0')ans = 10000000000;
    else if(s[0] == '1')ans = 20000000000;
  }
  else if(N == 2){
    if(flag == 3 || flag == 2)ans = 10000000000;
    else if(flag)ans = 9999999999;
  }
  else{
    if(flag == 3)ans = 10000000001 - (N + 2)/ 3;
    else if(flag == 2)ans = 10000000001 - (N + 3)/ 3;
    else if(flag == 1)ans = 10000000001 - (N + 4)/ 3;
  }
  
  printf("%lld\r\n", ans);
  
  return 0;
}