#include <bits/stdc++.h>
int a[200];
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    cin >> a[i];
  }
  int cur;
  cin >> cur;
  int ans = lower_bound(a, a + 2 * n, cur) - a;
  ans = n - (ans / 2);
  cout << ans;
}
