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