#include <bits/stdc++.h>
using namespace std;
const int N = 2;
const long long int MOD = 1e9 + 7;
bool comp(const pair<long long int, long long int> &p1,
          const pair<long long int, long long int> &p2) {
  long long int x = abs(p1.first - p1.second);
  long long int y = abs(p2.first - p2.second);
  if (x > y)
    return true;
  else
    return false;
}
void Solve() {
  long long int n, k;
  cin >> n;
  vector<pair<long long int, long long int> > v;
  for (long long int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    v.push_back({a, b});
  }
  cin >> k;
  sort(v.begin(), v.end());
  long long int ans = n;
  for (long long int i = 0; i < n; i++) {
    pair<long long int, long long int> p = v[i];
    if (p.first == k || p.second == k) break;
    if (k >= p.first && k <= p.second)
      break;
    else
      ans--;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  ;
  int T = 1;
  while (T--) {
    Solve();
  }
  return 0;
}
