#include <bits/stdc++.h>
using namespace std;
int n, k, ans, l[105], r[105];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &l[i], &r[i]);
  scanf("%d", &k);
  for (int i = 1; i <= n; i++) {
    if (r[i] >= k) {
      ans = n - i + 1;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
