#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int v1[maxn], dp[maxn];
int main() {
  int n;
  cin >> n;
  vector<int> v2;
  map<int, int> p;
  for (int i = 0; i < n; ++i) {
    cin >> v1[i];
    p[v1[i]] = i;
  }
  long long ans = 1, mod = 998244353;
  int now = p[v1[0]];
  for (int i = 1; i < n; ++i) {
    if (i <= now) {
      now = max(now, p[v1[i]]);
    } else {
      ans = (ans * 2) % mod;
      now = p[v1[i]];
    }
  }
  cout << ans;
}
