#include <bits/stdc++.h>
using namespace std;
const int maxn = 200 + 15;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
int n, m;
pair<int, int> p[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &p[i].first, &p[i].second);
  }
  int k;
  scanf("%d", &k);
  int tt = 0;
  while (tt < n) {
    if (k > p[tt].second)
      tt++;
    else
      break;
  }
  printf("%d\n", n - tt);
  return 0;
}
