#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<pair<int, int>> book;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    book.push_back({l, r});
  }
  int k;
  cin >> k;
  int ans = n;
  for (auto it = book.begin(); it != book.end(); it++) {
    if (k >= it->first && k <= it->second) {
      break;
    } else {
      ans -= 1;
    }
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
