#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, a[N];
const int mod = 998244353;
map<int, int> mp;
void checkmax(int &a, int b) {
  if (b > a) a = b;
}
void init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    mp[a[i]] = i;
  }
}
void solve() {
  int now_right = 1, ans = 1;
  for (int i = 1; i <= n; ++i) {
    if (now_right < i) {
      ans = ans * 2 % mod;
    }
    checkmax(now_right, mp[a[i]]);
  }
  printf("%d\n", ans);
}
int main() {
  init();
  solve();
  return 0;
}
