#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, i, j, k, m, s;
  scanf("%lld %lld %lld", &a, &b, &c);
  scanf("%lld", &i);
  k = 0;
  for (j = 1; j <= i; j++) {
    scanf("%lld", &m);
    if (((m > b && m < c) && (a > b && a < c)) ||
        ((a > c && a < b) && (m > c && m < b)) ||
        ((a > b && a > c) && (m > b && m > c)) ||
        ((a < b && a < c) && (m < b && m < c))) {
      k += 1;
    }
  }
  printf("%lld\n", k);
  return 0;
}
