#include <bits/stdc++.h>
using namespace std;
const int M = 998244353;
int main() {
  long long n;
  cin >> n;
  map<long long, long long> mp;
  long long a[200005];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]] = i;
  }
  long long ans = 1, w = mp[a[0]];
  for (int i = 0; i < n; i++) {
    if (i > w) {
      ans = (ans * 2) % M;
    }
    w = max(w, mp[a[i]]);
  }
  cout << ans;
}
