#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int A[200010];
vector<int> ed;
map<int, int> last;
int main() {
  int N, until = 0;
  long long res = 1;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d", &A[i]), last[A[i]] = i;
  for (int i = 0; i < N; i++) {
    if (i != 0 && until < i) res = (res * 2) % mod;
    until = max(until, last[A[i]]);
  }
  printf("%I64d\n", res);
  return 0;
}
