#include <iostream>
using namespace std;
string s;

int main() {
    ios::sync_with_stdio(0);
    cin>>s;
    bool flag = true;
    for(int i = 0;i<s.length();i++){
        if(i&1){
            if(!isupper(s[i])){
                flag = false;
                break;
            }
        }
        else{
            if(!islower(s[i])){
                flag = false;
                break;
            }
        }
    }
    if(flag){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define Pr pair<ll,ll>
#define Tp tuple<ll,ll,ll>
using Graph = vector<vector<int>>;

ll mod = 1000000007;

int main() {
    ll N; cin >> N;
    ll base = 1,cnt = 0;
    ll ans = 2e18;
    rep(i,62){
        ans = min(ans,N/base+N%base+cnt);
        base *= 2; cnt++;
    }
    cout << ans << endl;
}