#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll MOD = 1000 * 1000 * 1000 + 7;
constexpr int ALPHABET_SIZE = 26;
constexpr ll INF = 1e18;
pair<size_t, size_t> count_dp(int v, const vector<vector<int>>& g, int p = -1) {
  if (g[v].size() == 1) {
    return make_pair(1, 0);
  }
  pair<size_t, size_t> ans{0, 0};
  for (int u : g[v]) {
    if (u == p) {
      continue;
    }
    auto cur = count_dp(u, g, v);
    ans.first += cur.second;
    ans.second += cur.first;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  size_t n;
  cin >> n;
  vector<vector<int>> g(n);
  for (size_t i = 0; i < n - 1; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int root = 0;
  while (g[root].size() == 1) {
    ++root;
  }
  auto dp_res = count_dp(root, g);
  size_t min_ans = (dp_res.first == 0 || dp_res.second == 0) ? 1 : 3;
  unordered_map<int, size_t> par;
  for (size_t i = 0; i < n; ++i) {
    if (g[i].size() == 1) {
      ++par[g[i].front()];
    }
  }
  size_t max_ans = n - 1;
  for (auto [_, c] : par) {
    max_ans -= c - 1;
  }
  cout << min_ans << " " << max_ans << "\n";
  return 0;
}
