#include <bits/stdc++.h>
using namespace std;
vector<int> adj[300005];
long long dp[300005][3];
void dfs(int v, int par) {
  dp[v][0] = dp[v][1] = dp[v][2] = 1;
  long long cnt = 1;
  for (auto u : adj[v]) {
    if (u == par) continue;
    dfs(u, v);
    dp[v][2] = dp[v][2] * (dp[u][0] + dp[u][1] + dp[u][2]) % 998244353;
    dp[v][1] = dp[v][1] * (dp[u][1] + 2 * dp[u][0] + 2 * dp[u][2]) % 998244353;
    cnt = cnt * (dp[u][1] + dp[u][0] + dp[u][2]) % 998244353;
    dp[v][0] =
        dp[v][0] * (2 * dp[u][0] + 2 * dp[u][1] + 3 * dp[u][2]) % 998244353;
  }
  dp[v][0] = (dp[v][0] - cnt + 998244353) % 998244353;
  dp[v][1] = (dp[v][1] - cnt + 998244353);
}
void solve() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0);
  cout << (dp[1][0] + dp[1][1] + dp[1][2] - 1 + 998244353) % 998244353;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  while (t--) {
    solve();
  }
}
