#include <bits/stdc++.h>
using namespace std;
void File_input() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
}
void FastInputOutput() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
vector<pair<int, int> > book;
int n, l, r, mid, ans;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &l, &r);
    book.push_back({l, r});
  }
  scanf("%d", &mid);
  for (int i = 0; i < n; i++) {
    if (book[i].first <= mid && book[i].second >= mid) {
      ans = i;
      break;
    }
  }
  printf("%d", n - ans);
  return 0;
}
