#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int inf = 0x7fffffff;
const double eps = 1e-6;
const int maxn = (int)(2e5) + 7;
inline int read() {
  int f = 1, num = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) num = (num << 1) + (num << 3) + (ch ^ 48), ch = getchar();
  return num * f;
}
map<int, int> m;
int n, a[maxn];
long long ans = 1;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    m[a[i]] = i;
  }
  int R = m[a[1]];
  for (int i = 2; i <= n; i++) {
    if (R < i) ans = (ans * 2) % mod;
    R = max(R, m[a[i]]);
  }
  printf("%lld", ans);
  return 0;
}
