
// Problem : A - A*B*C
// Contest : AtCoder - AtCoder Regular Contest 113
// URL : https://atcoder.jp/contests/arc113/tasks/arc113_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、 
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)

#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy

//TWO POINTERS APPLICABLE??????
//CHECK EDGE CASES, ALWAYS
void solve()
{
	ll N;cin>>N;
	ll ans=0;
	FOR(x,1,N+1){
		FOR(y,1,N+1){
			if(x*(ll)y>N)break;
			ans+=N/(x*(ll)y);
		}
	}
	cout<<ans;
}

int main() 
{
	// think two times, so you won't have to code three times
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int Test_case=1;
	// cin>>Test_case;
	while(Test_case--!=0)
	{
		solve();
	}
	return 0;
}
// template by bqi343
#include <stdio.h>
#include <string.h>
#include <vector>
#include <set>
#include <queue>
#include <string>
#include <map>
#include <stdlib.h>
#include <time.h>
#include <algorithm>
#include <iostream>
#include <memory>
//防掉rating提示：想好正确的算法，错误的算法是不能通过的。任何题目都有可能难倒你，所以如果你短时间内想不到算法，放弃这题。
#include <cstdio>
const int MAXN = 200010;
int numbers[MAXN];
char word[MAXN];
std::string word_tag = "110";
int main()
{
	int t;
	int n;
	//freopen("in.txt", "r", stdin);
	//scanf("%d", &t);
	//while (t--)
	{
		scanf("%d", &n);
		scanf(" %s", word);
		long long res = 10000000000ll;
		if (n == 1) {
			if (word[0] == '0') {
				
			}
			else {
				res *= 2;
			}
			printf("%lld\n", res);
			return 0;
		}
		long long num_110_cnt = 1;
		int begin_pos = -1;
		for (int i = 0; i <= 2; i++) {
			int next = (i + 1) % 3;
			if (word_tag[i] == word[0] && word_tag[next] == word[1]) {
				begin_pos = i;
				break;
			}
		}
		if (begin_pos == -1) {
			printf("0\n");
			return 0;
		}
		bool tag = true;
		for (int i = begin_pos; i < begin_pos + n; i++) {
			if (i % 3 == 0 && i > 0) {
				num_110_cnt++;
			}
			if (word[i - begin_pos] != word_tag[i % 3]) {
				tag = false;
				break;
			}
		}
		if (!tag) {
			printf("0\n");
		}
		else {
			printf("%lld\n", res - num_110_cnt + 1);
		}
		/*printf("debug\n", res);
		for (long long i = 2; i <= n; i++) {
			printf("%lld\n", res % i);
		}*/
	}
	return 0;
}