#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, t, max, min, counter = 0;
  cin >> a >> b >> c >> t;
  int n[t];
  for (int i = 0; i < t; ++i) {
    cin >> n[i];
  }
  if (b > c) {
    max = b;
    min = c;
  } else {
    max = c;
    min = b;
  }
  for (int k = 0; k < t; ++k) {
    if (max > n[k] && min < n[k]) {
      counter++;
    }
  }
  cout << counter;
  return 0;
}
