#include <cstdio>
#include <queue>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
using namespace std;
#include <cstdio>
#define TLE std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
const ll mod = 1000000007 ;
const int INF=0x3f3f3f3f;
const int mxn = 1e5+7 ;
typedef pair<int,int> pii;
string str,s1,s2;
bool vis[mxn] ;
ll t,n,m,k,l,r,prime[mxn],isprime[mxn],bit[mxn],phi[mxn];
int main()
{
cin>>n;
for(int i=0;i<n;i++) cin>>a[i] ;
for(int i=0;i<n;i++) cin>>b[i] ;
sort(a,a+n);
sort(b,b+n);
ll ans = -1 ;
for(int i=0;i<n;i++)
{
ans = max(ans, a[i]+b[n-i-1]);
}
cout<<ans<<endl;
}
/// #include <bits/stdc++.h>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
using namespace std;
#include <cstdio>
#define TLE std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
const ll mod = 1000000007 ;
const int INF=0x3f3f3f3f;
const int mxn = 1e5+7 ;
typedef pair<int,int> pii;
string str,s1,s2;
bool vis[mxn] ;
ll t,n,m,k,l,r,prime[mxn],isprime[mxn],bit[mxn],phi[mxn];
int head[mxn],dis[mxn];
struct node
{
int v,w,nx;
} ans[mxn<<2];
void add(int u,int v,int w)
{
ans[++k].v = v ;
ans[k].w = w ;
ans[k].nx = head[u] ;
head[u]=k;
}
priority_queue<pii,vector<pii>,greater<pii> > q;
ll a[mxn] ;
map<pair<ll,ll>,ll>mp;
int main()
{
cin>>str;
int ans = 0 ;
for(int i=0; i<str.size();)
{
if(str[i]=='1' && str[i+1]=='0' || str[i]=='0' && str[i+1]=='1' )
ans++,i+=2;
else
{
if(str[i]=='1')
{
i++;
while(i<str.size() && str[i]!='0') i++;
if(str[i]=='0' && i<str.size())
ans++,i++;
}
else
{
i++;
while(i<str.size() && str[i]!='1') i++;
if(str[i]=='1' && i<str.size())
ans++,i++;
}
}
}
cout<<ans<<endl;
}