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