#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long md = 998244353) {
  long long res = 1;
  x %= md;
  while (y) {
    if (y & 1) res = (res * x) % md;
    x *= x;
    if (x >= md) x %= md;
    y >>= 1;
  }
  return res;
}
using namespace std;
struct node {
  vector<long long> v, w;
} nodes[300001];
inline long long mod(long long x, long long md = 998244353) {
  if (x < 0) {
    x = ((x >= 998244353) ? (x % 998244353) : x);
    return (x == 0) ? 0 : x + 998244353;
  } else {
    return ((x >= 998244353) ? (x % 998244353) : x);
  }
}
vector<vector<long long>> dp(300001, vector<long long>(3, 1));
bool vis[300000];
void solve(long long index, long long parent) {
  if (vis[index]) return;
  vis[index] = true;
  long long pro1 = 1;
  for (auto &x : nodes[index].v) {
    if (x != parent) {
      solve(x, index);
      long long a = dp[x][0];
      long long b = dp[x][1];
      long long c = dp[x][2];
      dp[index][0] *= a + b + c;
      dp[index][1] *= 3 * a + 2 * b + 2 * c;
      dp[index][2] *= 2 * a + 2 * b + c;
      pro1 *= a + b + c;
      for (auto &x : dp[index]) x = mod(x);
      pro1 = mod(pro1);
    }
  }
  dp[index][1] -= pro1;
  dp[index][2] -= pro1;
  for (long long i = 0; i < 3; i++) dp[index][i] = mod(dp[index][i]);
}
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long u, v;
    cin >> u >> v;
    u--;
    v--;
    nodes[u].v.push_back(v);
    nodes[v].v.push_back(u);
  }
  solve(0, -1);
  long long ans = dp[0][0] + dp[0][1] + dp[0][2] - 1;
  ans = mod(ans);
  cout << ans;
}
