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