#include using namespace std; #define rep(i, N) for (int i = 0; i < (N); i++) #define all(a) (a).begin(), (a).end() #define pb push_back using ll = long long; using i_i = tuple; void dfs_down(int u, int p, vector>& G, vector& down) { down[u] = true; for (int v: G[u]) if (v != p) { dfs_down(v, u, G, down); if (down[v]) down[u] = false; } } void dfs_up(int u, int p, vector>& G, vector& down, vector& up) { int cnt = up[u]; for (int v: G[u]) if (v != p) cnt += down[v]; for (int v: G[u]) if (v != p) { up[v] = (cnt - down[v] == 0); dfs_up(v, u, G, down, up); } } int main() { int N; cin >> N; vector> G(N); rep(i, N - 1) { int u, v; scanf("%d%d", &u, &v); u--; v--; G[u].pb(v); G[v].pb(u); } vector down(N); dfs_down(0, -1, G, down); vector up(N); dfs_up(0, -1, G, down, up); vector V; rep(u, N) if (down[u] && !up[u]) V.pb(u); int M = V.size(); cout << M << endl; rep(j, M) printf("%d\n", V[j] + 1); // rep(u, N) cout << down[u]; // cout << endl; // rep(u, N) cout << up[u]; // cout << endl; }