#include <bits/stdc++.h>
using namespace std;
int n;
long long arr[200002];
map<long long, long long> m;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    m[arr[i]] = i;
  }
  long long ret = 1;
  long long last = m[arr[0]];
  for (int i = 1; i < n; i++) {
    if (last < i) {
      ret *= 2;
      ret %= 998244353;
    }
    last = max(last, m[arr[i]]);
  }
  cout << ret << endl;
  return 0;
}
