#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
const double pi = 4.0 * atan(1.0);
using namespace std;
const int maxn = 2e5 + 10;
const int mod = 998244353;
int a[maxn];
map<int, int> mp;
map<int, int>::iterator it;
int main() {
  int n;
  scanf("%d", &n);
  int i, j;
  mp.clear();
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    mp[a[i]] = max(mp[a[i]], i);
  }
  int cnt = 0;
  int ma = 1;
  long long int ans = 1;
  for (i = 1; i <= n; i++) {
    if (mp[a[i]] == ma && ma == i) {
      ma = i + 1;
      cnt++;
    } else
      ma = max(ma, mp[a[i]]);
  }
  for (i = 1; i < cnt; i++) ans = ans * 2 % mod;
  printf("%lld\n", ans);
  return 0;
}
