#include <bits/stdc++.h>   using namespace std;   const long long MAXN = (long long)1e5 + 10;   vector<long long> G[MAXN];   pair<long long, long long> p;   vector<long long> v;   long long n, x, y, k, ans, sum, flag;   string s;   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x >> y;       v.push_back(x);       v.push_back(y);     }     cin >> k;     long long i = 0;     while (!flag) {       if (v[i] < k) {         i++;       } else {         flag = 1;         i--;       }     }     cout << n - (i + 1) / 2;     return 0;   }   