#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const double pi = acos(-1);
const long long MODPRIMA = (long long)1e9 + 7;
const long long MAXX = (long long)1e18;
const long long MINN = -(long long)1e18;
const double EPS = 1e-9;
const int MAXN = 2e5;
const int MOD = 998244353;
int arr[MAXN + 5];
map<int, int> mep;
int cnt, n, maks;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mep[arr[i]] = i;
  }
  int i = 1;
  maks = mep[arr[0]];
  cnt = 1;
  while (i < n) {
    if (i > maks) {
      cnt++;
      maks = mep[arr[i]];
    } else
      maks = max(maks, mep[arr[i]]);
    i++;
  }
  long long ans = 1;
  for (int i = 1; i <= cnt - 1; i++) {
    ans = (ans * 2) % MOD;
  }
  cout << ans << '\n';
  return 0;
}
