#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
T lcm(T a, T b) {
  return (b / gcd(a, b)) * a;
}
void print() {}
void pLine() { cout << endl; }
template <typename T, typename... arg>
void print(T x, arg... ar) {
  cout << x;
  print(ar...);
}
const double PI = acos(-1);
const double eps = 1e-9;
void sol() {
  int a, b, c;
  int n;
  int t, cnt = 0;
  cin >> a >> b >> c;
  cin >> n;
  if (b > c) swap(b, c);
  while (n--) {
    cin >> t;
    if (t > b and t < c) cnt++;
  }
  print(cnt);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  sol();
  return 0;
}
