#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
map<int, int> mmp;
long long qpow(long long a, long long b, long long m) {
  long long ans = 1, aa = a;
  while (b) {
    if (b & 1) ans = ans * aa % m;
    aa = aa * aa % m;
    b >>= 1;
  }
  return ans;
}
int a[200010];
int ccc[200010];
int main() {
  int n, i, x = 1;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    mmp[a[i]] = i;
  }
  int pos = 1;
  ccc[0] = mmp[a[1]];
  int num = 0;
  while (pos <= n) {
    while (pos <= n) {
      ccc[num] = max(mmp[a[pos]], ccc[num]);
      if (pos == ccc[num]) break;
      pos++;
    }
    if (pos == n) break;
    pos++;
    num++;
  }
  cout << qpow(2, num, mod) << endl;
}
