#include <bits/stdc++.h>
using namespace std;
int n, k;
pair<int, int> p[103];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &p[i].first, &p[i].second);
  scanf("%d", &k);
  for (int i = 1; i <= n; i++)
    if (k <= p[i].second && k >= p[i].first) {
      printf("%d\n", n - i + 1);
      break;
    }
}
