#include <bits/stdc++.h>
using namespace std;
void optimise() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
long long int mod = 998244353;
void normalize(long long int &a) { a = (a + mod) % mod; }
long long int modmul(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a * b) % mod;
}
long long int modadd(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a + b) % mod;
}
long long int modsub(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a - b + mod) % mod;
}
long long int me(long long int x, long long int n) {
  x %= mod;
  if (n == 0) return 1;
  long long int u = me(x, n / 2) % mod;
  u = (u * u) % mod;
  if (n % 2) u = (u * x) % mod;
  return u;
}
long long int me1(long long int x, long long int n) {
  if (n == 0) return 1;
  long long int u = me1(x, n / 2);
  u = u * u;
  if (n % 2) u = u * x;
  return u;
}
inline long long int fact(long long int r) {
  long long int ans = 1;
  while (r) ans = modmul(ans, r), r--;
  return ans;
}
inline long long int modInv(long long int a) { return me(a, mod - 2); }
inline long long int modDiv(long long int a, long long int b) {
  return modmul(a, modInv(b));
}
void solve() {
  long long int n;
  cin >> n;
  long long int arr[n + 1];
  map<long long int, long long int> pos;
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    pos[arr[i]] = i;
  }
  long long int curr = pos[arr[0]];
  long long int ans = 1;
  for (long long int i = 1; i < n; i++) {
    if (i <= curr) {
      curr = max(curr, pos[arr[i]]);
    } else {
      ans = modmul(ans, 2);
      curr = max(curr, pos[arr[i]]);
    }
  }
  cout << ans;
}
signed main() {
  optimise();
  long long int t;
  t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
}
