#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = (int)2e5 + 5;
const int MOD = 998244353;
int a[N];
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  map<int, int> l;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    l[a[i]] = i;
  }
  int cnt = 0;
  int r = 0;
  for (int i = 1; i <= n; ++i) {
    if (i > r) {
      ++cnt;
      r = l[a[i]];
    } else {
      r = max(r, l[a[i]]);
    }
  }
  ll ans = 1;
  for (int i = 1; i < cnt; ++i) {
    ans *= 2LL;
    ans %= MOD;
  }
  cout << ans;
  return 0;
}
