#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
typedef long long ll;
using namespace std;
const ll mod=100000000;
int main()
{
int n,m;
cin>>n>>m;
int s=0;
while(1)
{
if(n==0||m==0||(n<=1&&m<=1))
break;
if(n>=m)
{
n-=2;
m--;
}
else
{
m-=2;
n--;
}
s++;
}
cout<<s<<endl;
return 0;
}