#include <bits/stdc++.h>
using namespace std;
template <int MOD>
struct Modular {
  int value;
  Modular(int v = 0) : value(v) {
    while (v < 0) v += MOD;
  }
  Modular(long long v) : value(v % MOD) {
    while (v < 0) v += MOD;
  }
  Modular& operator+=(Modular const& b) {
    value += b.value;
    if (value >= MOD) value -= MOD;
    return *this;
  }
  Modular& operator-=(Modular const& b) {
    value -= b.value;
    if (value < 0) value += MOD;
    return *this;
  }
  Modular& operator*=(Modular const& b) {
    value = (long long)value * b.value % MOD;
    return *this;
  }
  friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }
  Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
  friend Modular operator+(Modular a, Modular const b) { return a += b; }
  friend Modular operator-(Modular a, Modular const b) { return a -= b; }
  friend Modular operator-(Modular const a) { return 0 - a; }
  friend Modular operator*(Modular a, Modular const b) { return a *= b; }
  friend Modular operator/(Modular a, Modular const b) { return a /= b; }
  friend std::ostream& operator<<(std::ostream& os, Modular const& a) {
    return os << a.value;
  }
  friend bool operator==(Modular const& a, Modular const& b) {
    return a.value == b.value;
  }
  friend bool operator!=(Modular const& a, Modular const& b) {
    return a.value != b.value;
  }
};
template <typename ModularType>
ModularType mexp(ModularType a, long long e) {
  if (a == 0) return 0;
  ModularType res = 1;
  while (e) {
    if (e & 1) res *= a;
    a *= a;
    e >>= 1;
  }
  return res;
}
using Mint = Modular<998244353>;
const int N = 3.1e5;
vector<int> T[N];
Mint dp[N][3];
void solve(int v, int par) {
  dp[v][0] = dp[v][1] = dp[v][2] = 1;
  for (int adj : T[v]) {
    if (adj == par) continue;
    solve(adj, v);
    dp[v][0] *= (1 + dp[adj][0] + dp[adj][1] + dp[adj][2]);
    dp[v][1] *= (3 + 3 * dp[adj][0] + 2 * dp[adj][1] + 2 * dp[adj][2]);
    dp[v][2] *= (2 + 2 * dp[adj][0] + 2 * dp[adj][1] + dp[adj][2]);
  }
  dp[v][1] -= dp[v][0];
  dp[v][2] -= dp[v][0];
  dp[v][0] -= 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 0; i + 1 < n; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    T[u].push_back(v);
    T[v].push_back(u);
  }
  solve(0, -1);
  Mint ans = 0;
  for (int i = 0; i < 3; i++) ans += dp[0][i];
  cout << ans << '\n';
  return 0;
}
