#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
const long long MOD = 998244353;
int A[MAXN], lst[MAXN];
map<int, int> M;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int cnt = 1;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    if (M.find(A[i]) == M.end()) M.insert(make_pair(A[i], cnt++));
    A[i] = M[A[i]];
    lst[A[i]] = i;
  }
  int cur = 1;
  long long ans = 1;
  while (cur <= n) {
    int lim = lst[A[cur]];
    for (int i = cur; i <= lim; i++) {
      lim = max(lim, lst[A[i]]);
    }
    cur = lim + 1;
    if (cur <= n) {
      ans = 2 * ans;
      ans = ans % MOD;
    }
  }
  cout << ans;
}
