#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const long long mod = 998244353;
map<int, int> mp;
int data[N];
int n;
inline long long qmul(long long a, long long b) {
  long long res = 0;
  while (b) {
    if (b & 1) res = (res + a) % mod;
    a = (a + a) % mod;
    b >>= 1;
  }
  return res;
}
inline long long qpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = qmul(res, a);
    a = qmul(a, a);
    b >>= 1;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &data[i]);
    mp[data[i]] = i;
  }
  int ans = -1, i, j, k;
  for (i = 1; i <= n;) {
    ans++;
    k = mp[data[i]];
    for (j = i + 1; j < k; j++) k = max(k, mp[data[j]]);
    i = k + 1;
  }
  printf("%I64d\n", qpow(2, ans));
  return 0;
}
