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