#include <bits/stdc++.h>
using namespace std;
const long long N = 200005;
long long n, cnt = 0;
long long a[N];
map<long long, long long> vt;
long long res = 1;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    vt[a[i]] = i;
  }
  long long l, r = 1;
  for (long long i = 1; i <= n; i++) {
    r = max(vt[a[i]], r);
    if (i == r) {
      cnt++;
      r = i + 1;
    }
  }
  for (long long i = 2; i <= cnt; i++) {
    res *= 2;
    res %= 998244353;
  }
  cout << res;
  return 0;
}
