#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int ans = 0;
  while (1) {
    if (n > m) {
      n -= 2;
      m--;
    } else {
      m -= 2;
      n--;
    }
    if (n < 0 || m < 0) break;
    ans++;
  }
  cout << ans << endl;
  ;
}
