#include <bits/stdc++.h>
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  int Answer = 0;
  while ((n > 0 && m > 0) && (m + n >= 3)) {
    if (n > m) {
      n -= 2;
      m--;
    } else {
      n--;
      m -= 2;
    }
    Answer++;
  }
  printf("%d", Answer);
}
