#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, count = 0;
  cin >> x >> y;
  while (true) {
    if ((x == 0 && y == 0) || (x == 0 && y >= 1) || (y == 0 && x >= 1) ||
        (x == 1 && y == 1)) {
      break;
    }
    if (x >= y) {
      x -= 2;
      y -= 1;
      count += 1;
    } else {
      y -= 2;
      x -= 1;
      count += 1;
    }
  }
  cout << count << endl;
l:
  return 0;
}
