#include <bits/stdc++.h>

int main() {
    freopen("binary.in", "r", stdin);
    freopen("binary.out", "w", stdout);
    int n;
    std::string s;
    std::cin >> n >> s;
    assert(n <= 20);
    int answer = 0;
    s += "$";
    for (int mask = 0; mask < (1 << n); mask++) {
        if (!(mask & 1))
            continue;
        std::vector <int> bits;
        for (int i = 0; i < n; i++)
            if (mask & (1 << i))
                bits.push_back(i);

        bool fail = false;
        bits.push_back((int)s.size() - 1);
        for (int i = 0; i < (int)bits.size() - 1; i++) {
            if (s[bits[i]] == s[bits[i + 1]] || bits[i] == bits[i + 1] - 1 || s[bits[i] + 1] == '0')
                fail = true;
        }
        if (fail)
            continue;
        ++answer;
    }
    printf("%d\n", answer);                   
    return 0;
}