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