#include<bits/stdc++.h>
using namespace std;
typedef long long   ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<pair<int,int>> vpi;
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define pb    push_back
#define rev(i,a,b) for(int i=a;i<b;i++)
#define sz(a)   (int)a.size()
#define all(a)  a.begin(),a.end()
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
const ll mod=1e9+7;//cout<<fixed<<setprecision(15);
ll exp(ll x,ll y){;ll res=1;while(y){if(y &1)res=res*x;x=x*x;y>>=1;}return res;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return (a/gcd(a,b) * b);}
bool prime(ll n){if(n<2)return 0;for(int i=2;i*i<=n;i++)if(n%i==0)return 0;return 1;}

int main()
{
    fast;
    int T=1;
    //cin>>T;
    while(T--)
    {
        ll n;
        cin>>n;
        int s=log2(n);
        ll ans=1e18;
        for(ll b=s;b>=0;b--)
        {
            ll a=n/exp(2,b);
            ll c=n-a*exp(2,b);
            ans=min(ans,a+b+c);
        }
        cout<<ans<<endl;
    }
}

// D - Circle Lattice Points
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using dbl = long double;

ll MAX = 2e9, scale = 1e4;
ll X, Y, R;

ll in(){
	dbl x; cin>>x;
	return round(x*scale);
}

ll lo_bin(ll dy2){
	ll ok = X;
	ll ng = -(MAX + 1);
	while(ok - ng > 1){
		ll x = (ok + ng) / 2;
		ll dx = x - X;
		if(dy2 + dx*dx <= R*R) ok = x;
		else ng = x;
	}
	// cout<<" ok "<<ok<<"\n";
	return ok;
}

ll hi_bin(ll dy2){
	ll ok = X;
	ll ng = MAX + 1;
	while(ng - ok > 1){
		ll x = (ok + ng) / 2;
		ll dx = x - X;
		if(dy2 + dx*dx <= R*R) ok = x;
		else ng = x;
	}
	return ok;
}

int main(){
	X = in(), Y = in(), R = in();
	ll ans = 0;
	for(ll y=-MAX; y<=MAX; y+=scale){
		ll dy = y - Y;
		ll dy2 = dy*dy;
		if(R*R - dy2 < 0) continue;
		ans += floor(hi_bin(dy2) / (dbl)scale)
		 - ceil(lo_bin(dy2) / (dbl)scale) + 1;
	}
	cout<< ans <<endl;
}
