#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n + 1), b(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
  long long k;
  cin >> k;
  long long x;
  for (int i = 1; i <= n; i++)
    if (k >= a[i] && k <= b[i]) {
      x = i;
      break;
    }
  cout << n - x + 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(0);
  solve();
}
