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