#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b;
  c = 0;
  while (a > 0 && b > 0) {
    if (a > b) {
      a -= 2;
      b--;
      c++;
    } else {
      if (b == 1) break;
      a--;
      b -= 2;
      c++;
    }
  }
  cout << c << endl;
  return 0;
}
