#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<pair<long long, long long>> r(n);
  for (long long i = 0; i < n; ++i) cin >> r[i].first >> r[i].second;
  long long k;
  cin >> k;
  --k;
  long long f = 0;
  for (auto x : r) {
    if ((k >= x.first) && (k >= x.second))
      ++f;
    else
      break;
  }
  cout << n - f;
}
