#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, q;
vector<int> e[N];
int nin[N], nou[N], wei[N], dep[N];
int Nin, Nou, cha[N][50];
bool father(int first, int second) {
  return nin[first] <= nin[second] && nou[first] >= nou[second];
}
void DFS(int first, int p) {
  nin[first] = ++Nin;
  wei[first] = 1;
  if (first != 1) dep[first] = dep[p] + 1;
  cha[first][0] = p;
  for (int i(1); i <= 30; i++) cha[first][i] = cha[cha[first][i - 1]][i - 1];
  for (auto& i : e[first])
    if (i != p) DFS(i, first), wei[first] += wei[i];
  nou[first] = ++Nou;
}
int LCA(int first, int second) {
  if (father(first, second)) return first;
  if (father(second, first)) return second;
  for (int i(30); 0 <= i; i--)
    if (!father(cha[first][i], second)) first = cha[first][i];
  return cha[first][0];
}
int GO(int first, int second) {
  if (!father(second, first)) return 0;
  for (int i(30); 0 <= i; i--)
    if (!father(cha[first][i], second)) first = cha[first][i];
  return first;
}
int main() {
  n = ({
    long long first = 0;
    int n = 0, c = getchar();
    for (; !isdigit(c); c = getchar()) n = c == '-';
    for (; isdigit(c); c = getchar()) first = first * 10 + c - '0';
    n ? -first : first;
  });
  for (int i(1); i <= n - 1; i++) {
    int first = ({
      long long first = 0;
      int n = 0, c = getchar();
      for (; !isdigit(c); c = getchar()) n = c == '-';
      for (; isdigit(c); c = getchar()) first = first * 10 + c - '0';
      n ? -first : first;
    }),
        second = ({
          long long first = 0;
          int n = 0, c = getchar();
          for (; !isdigit(c); c = getchar()) n = c == '-';
          for (; isdigit(c); c = getchar()) first = first * 10 + c - '0';
          n ? -first : first;
        });
    e[first].push_back(second), e[second].push_back(first);
  }
  DFS(1, 1);
  q = ({
    long long first = 0;
    int n = 0, c = getchar();
    for (; !isdigit(c); c = getchar()) n = c == '-';
    for (; isdigit(c); c = getchar()) first = first * 10 + c - '0';
    n ? -first : first;
  });
  for (int ___(1); ___ <= q; ___++) {
    int first = ({
      long long first = 0;
      int n = 0, c = getchar();
      for (; !isdigit(c); c = getchar()) n = c == '-';
      for (; isdigit(c); c = getchar()) first = first * 10 + c - '0';
      n ? -first : first;
    }),
        second = ({
          long long first = 0;
          int n = 0, c = getchar();
          for (; !isdigit(c); c = getchar()) n = c == '-';
          for (; isdigit(c); c = getchar()) first = first * 10 + c - '0';
          n ? -first : first;
        });
    if (first == second) {
      cout << n << "\n";
      continue;
    }
    int lca = LCA(first, second);
    int len = dep[first] + dep[second] - 2 * dep[lca];
    if (len % 2 == 1) {
      cout << 0 << "\n";
      continue;
    }
    if (dep[first] - dep[lca] < dep[second] - dep[lca]) swap(first, second);
    int pos = first;
    for (bool ___ = 1; ___; ___ = 0) {
      for (int ln = len / 2, j = 0; ln > 0; ln >>= 1, j++)
        if (ln & 1) pos = cha[pos][j];
    }
    long long res = 0;
    if (pos != lca)
      cout << wei[pos] - wei[GO(first, pos)] << "\n";
    else {
      cout << n - wei[GO(first, pos)] - wei[GO(second, pos)] << "\n";
    }
  }
}
