#include <bits/stdc++.h>
#define deb2(x, y) cout << #x << "=" << x << ", " << #y << "=" << y << endl
using namespace std;
int main() {
string s; cin >> s;
reverse(s.begin(), s.end());
s += "00";
int j =0, cnt = 0;
for (int i = 0; i < s.size()+1; i ++ ) {
if(s[i] == '1' && s[i+1] == '0') cnt += 1;
if(s[i] == '1' && s[i+1] == '1') {
j = i + 1, s[i] = '0';
while(j < s.size() && s[j] == '1') {
s[j] = '0', j ++ ;
}
s[j] = '1', i = j - 1, cnt += 1;
}
}
cout << cnt;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
int n; cin >> n;
int maxn_a = 0, maxn_c = 0, x = 0;
for (int i = 1; i <= n; i ++ ) {
cin >> x;
maxn_a = max(maxn_a, x);
}
long long sum = 0;
for (int i = 1; i <= n; i ++ ) {
cin >> x;
sum += x;
maxn_c = max(maxn_c, x);
}
cout << (long long)(maxn_a + sum - maxn_c);
}