#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int md = 998244353;
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  map<int, int> tail;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    tail[a[i]] = i;
  }
  int ret = 1;
  int pt = tail[a[0]];
  for (int i = 1; i < n; i++) {
    if (i <= pt) {
      pt = max(pt, tail[a[i]]);
    } else {
      ret = 1LL * ret * 2 % md;
      pt = tail[a[i]];
    }
  }
  printf("%d\n", ret);
  return 0;
}
