#include <bits/stdc++.h>

using namespace std;
using INT = long long;

const int NN=33, mod=1e9+7;

INT C[NN][NN];

void add(int &u, int x) {
	u+=x;
	if (u>=mod) u-=mod;
}

int power(int a, int b, int c, int ans=1) {
	for (; b; b>>=1, a=(INT)a*a%mod) if (b&1) ans=(INT)ans*a%mod;
	return ans;
}

#define bit(x, y) (((x)>>(y))&1)
INT calc1(int a, int n, int b, int m, int L) {
	for (int i=0; i<min(n, m); i++) {
		if (bit(a, L-i-1) && bit(b, L-i-1)) return 0;
	}
	int d=0;
	if (n>m) {
		for (int i=m; i<n; i++) if (!bit(a, L-i-1)) d++;
	} else {
		for (int i=n; i<m; i++) if (!bit(b, L-i-1)) d++;
	}
	INT ans = 0;
	L-=max(n, m);
	for (int i=0; i<=L; i++) ans+=C[L][i]*(1LL<<L-i);
	return ans*(1LL<<d);
}

INT calc(int n, int m) {
	if (n<0) return 0;
	if (n==0) return m+1;
	int L=32-__builtin_clz(m);
	INT ans = 0;
	for (int i=1; i<=L; i++) if ((m>>(L-i))&1) {
		m^=1<<L-i;
		for (int j=1; j<=L; j++) if ((n>>(L-j))&1) {
			n^=1<<L-j;
			ans+=calc1(n, j, m, i, L);
			n^=1<<L-j;
		}
		m^=1<<L-i;
	}
	return ans;
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	int T, L, R;
	for (int i=0; i<NN; i++) for (int j=C[i][0]=1; j<=i; j++) C[i][j]=C[i-1][j]+C[i-1][j-1];
	for (cin>>T; T--; ) {
		cin>>L>>R;
		cout<<calc(R+1, R+1)-calc(L, R+1)*2+calc(L, L)<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;
using INT = long long;

const int NN=33;

INT C[NN][NN];

#define bit(x, y) (((x)>>(y))&1)

INT calc1(int a, int n, int b, int m, int L) {
	for (int i=0; i<min(n, m); i++) {
		if (bit(a, L-i-1) && bit(b, L-i-1)) return 0;
	}
	int d=0;
	if (n>m) {
		for (int i=m; i<n; i++) if (!bit(a, L-i-1)) d++;
	} else {
		for (int i=n; i<m; i++) if (!bit(b, L-i-1)) d++;
	}
	INT ans = 0;
	L-=max(n, m);
	for (int i=0; i<=L; i++) ans+=C[L][i]*(1LL<<L-i);
	return ans*(1LL<<d);
}

INT calc(int n, int m) {
	if (n==0) return 0;
	int L=32-__builtin_clz(m);
	INT ans = 0;
	for (int i=1; i<=L; i++) if ((m>>(L-i))&1) {
		m^=1<<L-i;
		for (int j=1; j<=L; j++) if ((n>>(L-j))&1) {
			n^=1<<L-j;
			ans+=calc1(n, j, m, i, L);
			n^=1<<L-j;
		}
		m^=1<<L-i;
	}
	return ans;
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	int T, L, R;
	for (int i=0; i<NN; i++) for (int j=C[i][0]=1; j<=i; j++) C[i][j]=C[i-1][j]+C[i-1][j-1];
	for (cin>>T; T--; ) {
		cin>>L>>R;
		cout<<calc(R+1, R+1)-calc(L, R+1)*2+calc(L, L)<<endl;
	}

	return 0;
}


#include<bits/stdc++.h>

#define x first
#define y second

using namespace std;

typedef long long INT;

int calc(int L, int x) {
	if(L < 0) return 0;

	int id = 31 - __builtin_clz(L);

	if((1<<id+1) == L + 1) id++;

	int cnt = 0;
	for(int j=0; j<id; j++) if(((x>>j) & 1) == 0) {
		cnt++;
	}

	int ans = (1<<cnt);
	if((x>>id)&1) return ans;
	return ans + calc(L - (1<<id), x);
}

INT solve(int L, int R) {
	if(L == R) {
		if((L^L) == L*2) return 1;
		return 0;
	}
	if(L % 2 == 1) {
		int res = 0;
		if((L^L) == L * 2) res = 1;
		res += 2ll * (calc(R, L) - calc(L, L));
		return res + solve(L+1, R);
	}
	if(R % 2 == 0) {
		INT res = 0;
		if((R^R) == R*2) res = 1;
		res += (INT) 2 * (calc(R-1, R) - calc(L-1, R));
		return res + solve(L, R - 1);
	}
	return solve(L / 2, R / 2) * 3;
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int T;

	cin >> T;

	while(T--) {
		int L, R;
		cin >> L >> R;
//		int res = 0;
//		for(int i=L; i<=R; i++) for(int j=L; j<=R; j++) if((i^j) == (i +j)) {
//			res++;
//		}
		cout << solve(L, R) << endl;
	}

	return 0;
}


#include <cstdio>
#include <cstring>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
#define pEnter putchar('\n');
#define pInt(n) printf("%d\n", (n));
#define getInt(n) scanf("%d",&(n));
#define pVarInt(v) printf("%s = %d\n",#v,(v));
#define rep(var, s, t) for(int var=(s); var<=(t); var++)
void PrintArrInt(int arr[], int s, int e){for(int i=s;i<=e;i++){if(i==s)printf("%d",arr[i]);else printf(" %d",arr[i]);}putchar('\n');}

const int maxn = 50 + 5;
LL dp[maxn];
int digst1[maxn], digst2[maxn];

LL dfs(int pos, int limit1, int limit2){
    if(pos==0) return 1;
    if(!limit1 && !limit2 && dp[pos]!=-1) return dp[pos];
    int mx1=(limit1?digst1[pos]:1);
    int mx2=(limit2?digst2[pos]:1);
    LL ans = 0;
    rep(i, 0, mx1) rep(j, 0, mx2) {
        if((i & j)==0) ans+=dfs(pos-1, limit1&&i==digst1[pos], limit2&&j==digst2[pos]);
    }
    if(!limit1 && !limit2) dp[pos]=ans;
    return ans;
}

LL solve(int r1, int r2){
    if(r1<0 || r2<0) return 0;
    memset(dp, -1, sizeof(dp));
    rep(i, 1, 31){
        digst1[i] = (r1&1);
        digst2[i] = (r2&1);
        r1>>=1; r2>>=1;
    }
    return dfs(31, true, true);
}

int main() {
    int T; getInt(T);
    while(T--){
        int l, r; scanf("%d%d", &l, &r);
        printf("%lld\n", solve(r, r)-solve(l-1, r)*2+solve(l-1, l-1));
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
#define pEnter putchar('\n');
#define pInt(n) printf("%d\n", (n));
#define getInt(n) scanf("%d",&(n));
#define pVarInt(v) printf("%s = %d\n",#v,(v));
#define rep(var, s, t) for(int var=(s); var<=(t); var++)
void PrintArrInt(int arr[], int s, int e){for(int i=s;i<=e;i++){if(i==s)printf("%d",arr[i]);else printf(" %d",arr[i]);}putchar('\n');}

const int maxn = 50 + 5;
LL dp[maxn][2][2];
int digst1[maxn], digst2[maxn];

LL dfs(int pos, int limit1, int limit2){
    if(pos==0) return 1;
    if(dp[pos][limit1][limit2]!=-1) return dp[pos][limit1][limit2];
    int mx1=(limit1?digst1[pos]:1);
    int mx2=(limit2?digst2[pos]:1);
    LL ans = 0;
    rep(i, 0, mx1) rep(j, 0, mx2) {
        if((i & j)==0) ans+=dfs(pos-1, limit1&&i==digst1[pos], limit2&&j==digst2[pos]);
    }
    return dp[pos][limit1][limit2]=ans;
}

LL solve(int r1, int r2){
    if(r1<0 || r2<0) return 0;
    memset(dp, -1, sizeof(dp));
    rep(i, 1, 31){
        digst1[i] = (r1&1);
        digst2[i] = (r2&1);
        r1>>=1; r2>>=1;
    }
    return dfs(31, true, true);
}

int main() {
    int T; getInt(T);
    while(T--){
        int l, r; scanf("%d%d", &l, &r);
        printf("%lld\n", solve(r, r)-solve(l-1, r)*2+solve(l-1, l-1));
    }
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
#define debug(a) cout << #a": " << a << endl;
#define mst(a, b) memset(a, b, sizeof(a))
#define ALL(x) x.begin(), x.end()
#define lc rt << 1
#define rc rt << 1 | 1
#define X first
#define Y second
inline int lowbit(int x) { return x & -x; }
typedef long long ll;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
const int N = 2000 + 10;
const int M = 4e6 + 10;
const int maxn = 2e3 + 10;
const int maxm = 4e3 + 10;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
const int mod = 1e9 + 7;
const db eps = 1e-5;

LL dp[40][2][2];
int a[40];
int b[40];

LL dfs(int cur, bool limitA, bool limitB) {
    if (cur == -1)
        return 1;
    LL& res = dp[cur][limitA][limitB];
    if (~res)
        return res;
    int topA = limitA ? a[cur] : 1;
    int topB = limitB ? b[cur] : 1;
    res = 0;
    for (int i = 0; i <= topA; i++) {
        for (int j = 0; j <= topB; j++) {
            if (i == 1 && j == 1)
                continue;
            res += dfs(cur - 1, limitA && i == topA, limitB && j == topB);
        }
    }
    return res;
}
LL solve(int l, int r) {
    if (l == -1 && r == -1)
        return 0;
    if (l == -1 || r == -1)
        return max(l, r);
    mst(dp, -1);
    for (int i = 30; i >= 0; i--) {
        a[i] = l >> i & 1;
        b[i] = r >> i & 1;
    }
    return dfs(30, true, true);
}

int main() {
#ifdef purple_bro
    freopen("in.txt","r",stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;

    cin >> T;

    for (; T--;) {
        int l, r;

        cin >> l >> r;

        cout << solve(r, r) - solve(l - 1, r) - solve(r, l - 1) + solve(l - 1, l - 1) << "\n";
    }

    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
#define debug(a) cout << #a": " << a << endl;
#define mst(a, b) memset(a, b, sizeof(a))
#define ALL(x) x.begin(), x.end()
#define lc rt << 1
#define rc rt << 1 | 1
#define X first
#define Y second
inline int lowbit(int x) { return x & -x; }
typedef long long ll;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;
const int N = 2000 + 10;
const int M = 4e6 + 10;
const int maxn = 2e3 + 10;
const int maxm = 4e3 + 10;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
const int mod = 1e9 + 7;
const db eps = 1e-5;

LL dp[40][2][2];
int a[40];
int b[40];

LL dfs(int cur, bool limitA, bool limitB) {
    if (cur == -1)
        return 1;
    LL& res = dp[cur][limitA][limitB];
    if (~res)
        return res;
    int topA = limitA ? a[cur] : 1;
    int topB = limitB ? b[cur] : 1;
    res = 0;
    for (int i = 0; i <= topA; i++) {
        for (int j = 0; j <= topB; j++) {
            if (i == 1 && j == 1)
                continue;
            res += dfs(cur - 1, limitA && i == topA, limitB && j == topB);
        }
    }
    return res;
}
LL solve(int l, int r) {
    if (l == -1 || r == -1)
        return 0;
    mst(dp, -1);
    for (int i = 30; i >= 0; i--) {
        a[i] = l >> i & 1;
        b[i] = r >> i & 1;
    }
    return dfs(30, true, true);
}

int main() {
#ifdef purple_bro
    freopen("in.txt","r",stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;

    cin >> T;

    for (; T--;) {
        int l, r;

        cin >> l >> r;

        cout << solve(r, r) - solve(l - 1, r) - solve(r, l - 1) + solve(l - 1, l - 1) << "\n";
    }

    return 0;
}


#include    <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b)  for(int i=(a);i<(b);++i)
#define fi  first
#define se  second
#define LL  unsigned long long
#define uint unsigned int
#define pb  push_back
#define eb  emplace_back
#define bit(s,i) ((s >> i) & 1)
#define off(s,i) (s & (~ (1 << i)))
#define ii pair <int , int>
#define iii1 pair <ii , int>
#define iii2 pair <int , ii>
#define TASK "1245F"
using   namespace   std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int oo = 0x3f;
int t;
long long f[32][2][2];
int digit1[32] , digit2[32];
///--------------------------
long long F(int id,int tight1 ,int tight2) {
    if (id < 0) return 1;
    long long &res = f[id][tight1][tight2];
    if (res != -1) return res;
    res = 0;
    for (int x = 0 ; x < 2 ; ++x)
    if (tight1 || (x <= digit1[id])) {
        for (int y = 0 ; y < 2 ; ++y)
        if ((tight2 || (y <= digit2[id])) && !(x & y))
        res += F(id - 1 , tight1 || (x < digit1[id]) , tight2 || (y < digit2[id]));
    }
    return res;
}
///--------------------------
long long cal(int a,int b) {
    if (min(a,b) < 0) return 0;
    int cnt1 , cnt2;
    cnt1 = cnt2 = 0;
    memset(digit1 , 0 , sizeof(digit1));
    memset(digit2 , 0 , sizeof(digit2));
    while (a > 0) {
        digit1[cnt1++] = a % 2;
        a /= 2;
    }
    while (b > 0) {
        digit2[cnt2++] = b % 2;
        b /= 2;
    }
    memset(f,-1,sizeof(f));
    return F(31 , 0 , 0);
}
///--------------------------
void readf() {
    cin >> t;
}
///--------------------------
void solve() {
    for (int lz = 1 ; lz <= t ; ++lz) {
        int l , r;
        cin >> l >> r;
        cout << cal(r , r) - cal(l - 1 , r) - cal(r , l - 1) + cal(l - 1 , l - 1) << '\n';
    }
}
///--------------------------
int main() {
   #ifdef BDP0509
       freopen(TASK".inp", "r", stdin);
       freopen(TASK".out", "w", stdout);
   #endif // ONLINE_JUDGE
   ios::sync_with_stdio(0);
   cin.tie(0);cout.tie(0);
   readf();
   solve();
}


#include    <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b)  for(int i=(a);i<(b);++i)
#define fi  first
#define se  second
#define LL  unsigned long long
#define uint unsigned int
#define pb  push_back
#define eb  emplace_back
#define bit(s,i) ((s >> i) & 1)
#define off(s,i) (s & (~ (1 << i)))
#define ii pair <int , int>
#define iii1 pair <ii , int>
#define iii2 pair <int , ii>
#define TASK "1245F"
using   namespace   std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int oo = 0x3f;
int t;
long long f[32][2][2][2][2];
int digit1[32] , digit2[32];
///--------------------------
long long F(int id,int tight1 ,int tight2 ,int ok1 ,int ok2) {
    if (id < 0) return 1;
    long long &res = f[id][tight1][tight2][ok1][ok2];
    if (res != -1) return res;
    res = 0;
    for (int x = 0 ; x < 2 ; ++x)
    if (tight1 || (x <= digit1[id])) {
        for (int y = 0 ; y < 2 ; ++y)
        if ((tight2 || (y <= digit2[id])) && !(x & y))
        res += F(id - 1 , tight1 || (x < digit1[id]) , tight2 || (y < digit2[id]) , ok1 || (x > 0) , ok2 || (y > 0));
    }
    return res;
}
///--------------------------
long long cal(int a,int b) {
    int cnt1 , cnt2;
    cnt1 = cnt2 = 0;
    memset(digit1 , 0 , sizeof(digit1));
    memset(digit2 , 0 , sizeof(digit2));
    while (a > 0) {
        digit1[cnt1++] = a % 2;
        a /= 2;
    }
    while (b > 0) {
        digit2[cnt2++] = b % 2;
        b /= 2;
    }
    memset(f,-1,sizeof(f));
    return F(31 , 0 , 0 , 0 , 0);
}
///--------------------------
void readf() {
    cin >> t;
}
///--------------------------
void solve() {
    for (int lz = 1 ; lz <= t ; ++lz) {
        int l , r;
        cin >> l >> r;
        cout << cal(r , r) - 1ll * (l != 0) * (cal(l - 1 , r) + cal(r , l - 1) - cal(l - 1 , l - 1)) << '\n';
    }
}
///--------------------------
int main() {
   #ifdef BDP0509
       freopen(TASK".inp", "r", stdin);
       freopen(TASK".out", "w", stdout);
   #endif // ONLINE_JUDGE
   ios::sync_with_stdio(0);
   cin.tie(0);cout.tie(0);
   readf();
   solve();
}


#include    <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b)  for(int i=(a);i<(b);++i)
#define fi  first
#define se  second
#define LL  unsigned long long
#define uint unsigned int
#define pb  push_back
#define eb  emplace_back
#define bit(s,i) ((s >> i) & 1)
#define off(s,i) (s & (~ (1 << i)))
#define ii pair <int , int>
#define iii1 pair <ii , int>
#define iii2 pair <int , ii>
#define TASK "1245F"
using   namespace   std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int oo = 0x3f;
int t;
long long f[32][2][2][2][2];
int digit1[32] , digit2[32];
///--------------------------
long long F(int id,int tight1 ,int tight2 ,int ok1 ,int ok2) {
    if (id < 0) return 1;
    long long &res = f[id][tight1][tight2][ok1][ok2];
    if (res != -1) return res;
    res = 0;
    for (int x = 0 ; x < 2 ; ++x)
    if (tight1 || (x <= digit1[id])) {
        for (int y = 0 ; y < 2 ; ++y)
        if ((tight2 || (y <= digit2[id])) && !(x & y))
        res += F(id - 1 , tight1 || (x < digit1[id]) , tight2 || (y < digit2[id]) , ok1 || (x > 0) , ok2 || (y > 0));
    }
    return res;
}
///--------------------------
long long cal(int a,int b) {
    int cnt1 , cnt2;
    cnt1 = cnt2 = 0;
    memset(digit1 , 0 , sizeof(digit1));
    memset(digit2 , 0 , sizeof(digit2));
    while (a > 0) {
        digit1[cnt1++] = a % 2;
        a /= 2;
    }
    while (b > 0) {
        digit2[cnt2++] = b % 2;
        b /= 2;
    }
    memset(f,-1,sizeof(f));
    return F(31 , 0 , 0 , 0 , 0);
}
///--------------------------
void readf() {
    cin >> t;
}
///--------------------------
void solve() {
    for (int lz = 1 ; lz <= t ; ++lz) {
        int l , r;
        cin >> l >> r;
        //memset(f,-1,sizeof(f));
        cout << cal(r , r) - cal(l - 1 , r) - cal(r , l - 1) + cal(l - 1 , l - 1) << '\n';
    }
}
///--------------------------
int main() {
   #ifdef BDP0509
       freopen(TASK".inp", "r", stdin);
       freopen(TASK".out", "w", stdout);
   #endif // ONLINE_JUDGE
   ios::sync_with_stdio(0);
   cin.tie(0);cout.tie(0);
   readf();
   solve();
}


#include    <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b)  for(int i=(a);i<(b);++i)
#define fi  first
#define se  second
#define LL  unsigned long long
#define uint unsigned int
#define pb  push_back
#define eb  emplace_back
#define bit(s,i) ((s >> i) & 1)
#define off(s,i) (s & (~ (1 << i)))
#define ii pair <int , int>
#define iii1 pair <ii , int>
#define iii2 pair <int , ii>
#define TASK "1245F"
using   namespace   std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int oo = 0x3f;
int t;
long long f[32][2][2][2][2];
int digit1[32] , digit2[32];
///--------------------------
long long F(int id,int okxl ,int okxr ,int okyl ,int okyr) {
    if (id < 0) return 1;
    long long &res = f[id][okxl][okxr][okyl][okyr];
    if (res != -1) return res;
    res = 0;
    for (int x = min(1 - okxl , digit1[id]) ; x <= max(0 + okxr , digit2[id]) ; ++x)
    for (int y = min(1 - okyl , digit1[id]) ; y <= max(0 + okyr , digit2[id]) ; ++y)
    if (!(x & y)) res = res + F(id - 1 , okxl || (x > digit1[id]) , okxr || (x < digit2[id])
                                       , okyl || (y > digit1[id]) , okyr || (y < digit2[id]));
    return res;
}
///--------------------------
long long cal(int a,int b) {
    int cnt1 , cnt2;
    cnt1 = cnt2 = 0;
    memset(digit1 , 0 , sizeof(digit1));
    memset(digit2 , 0 , sizeof(digit2));
    while (a > 0) {
        digit1[cnt1++] = a % 2;
        a /= 2;
    }
    while (b > 0) {
        digit2[cnt2++] = b % 2;
        b /= 2;
    }
    memset(f,-1,sizeof(f));
    return F(31 , 0 , 0 , 0 , 0);
}
///--------------------------
void readf() {
    cin >> t;
}
///--------------------------
void solve() {
    for (int lz = 1 ; lz <= t ; ++lz) {
        int l , r;
        cin >> l >> r;
        cout << cal(l , r) << '\n';
    }
}
///--------------------------
int main() {
   #ifdef BDP0509
       freopen(TASK".inp", "r", stdin);
       freopen(TASK".out", "w", stdout);
   #endif // ONLINE_JUDGE
   ios::sync_with_stdio(0);
   cin.tie(0);cout.tie(0);
   readf();
   solve();
}


#include    <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b)  for(int i=(a);i<(b);++i)
#define fi  first
#define se  second
#define LL  unsigned long long
#define uint unsigned int
#define pb  push_back
#define eb  emplace_back
#define bit(s,i) ((s >> i) & 1)
#define off(s,i) (s & (~ (1 << i)))
#define ii pair <int , int>
#define iii1 pair <ii , int>
#define iii2 pair <int , ii>
#define TASK "1245F"
using   namespace   std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int oo = 0x3f;
int t;
long long f[32][2][2];
int digit1[32] , digit2[32];
///--------------------------
long long F(int id,int tight1 ,int tight2) {
    if (id < 0) return 1;
    long long &res = f[id][tight1][tight2];
    if (res != -1) return res;
    res = 0;
    for (int x = 0 ; x < 2 ; ++x)
    if (tight1 || (x <= digit1[id])) {
        for (int y = 0 ; y < 2 ; ++y)
        if ((tight2 || (y <= digit2[id])) && !(x & y))
        res += F(id - 1 , tight1 || (x < digit1[id]) , tight2 || (y < digit2[id]));
    }
    return res;
}
///--------------------------
long long cal(int a,int b) {
    int cnt1 , cnt2;
    cnt1 = cnt2 = 0;
    memset(digit1 , 0 , sizeof(digit1));
    memset(digit2 , 0 , sizeof(digit2));
    while (a > 0) {
        digit1[cnt1++] = a % 2;
        a /= 2;
    }
    while (b > 0) {
        digit2[cnt2++] = b % 2;
        b /= 2;
    }
    return F(31 , 0 , 0);
}
///--------------------------
void readf() {
    cin >> t;
}
///--------------------------
void solve() {
    memset(f,-1,sizeof(f));
    for (int lz = 1 ; lz <= t ; ++lz) {
        int l , r;
        cin >> l >> r;
        cout << cal(r , r) - cal(l - 1 , r) - cal(r , l - 1) + cal(l - 1 , l - 1) << '\n';
    }
}
///--------------------------
int main() {
   #ifdef BDP0509
       freopen(TASK".inp", "r", stdin);
       freopen(TASK".out", "w", stdout);
   #endif // ONLINE_JUDGE
   ios::sync_with_stdio(0);
   cin.tie(0);cout.tie(0);
   readf();
   solve();
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define debug(x) cout<<#x<<" is "<<x<<endl;
const int maxn=1e6+5;
const ll mod=1e9+7;

ll dp[34][2][2],num1[34],num2[34];

ll dfs(int pos,int limit1,int limit2){
    if(pos==-1)return 1;
    if(dp[pos][limit1][limit2]!=-1)return dp[pos][limit1][limit2];
    int u1=limit1?num1[pos]:1;
    int u2=limit2?num2[pos]:1;
    ll ans=0;
    for(int i=0;i<=u1;i++){
        for(int j=0;j<=u2;j++){
            if(i&j)continue;
            ans+=dfs(pos-1,limit1&&(i==u1),limit2&&(j==u2));
        }
    }
    return dp[pos][limit1][limit2]=ans;
}

ll sol(ll l,ll r){
    memset(dp,-1,sizeof(dp));
    ll ac=0;
    for(int i=0;i<=30;i++){
        num1[i]=1&(l>>i);
        num2[i]=1&(r>>i);
       /* num1[i]=l%2;
        num2[i]=r%2;
        l>>=1;
        r>>=1;*/
    }
    ac+=dfs(30,1,1);
    return ac;
}

int main(){
    int t;
    scanf("%d",&t);
   /* ll ss=13;
    for(int i=30;i>=0;i--){
        int w=(1&(ss>>i));
        debug(w);
    }*/
    while(t--){
        ll l,r;
        scanf("%lld%lld",&l,&r);
        printf("%lld\n",sol(r,r)-sol(l-1,r)-sol(r,l-1)+sol(l-1,l-1));
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
		int l,r;
int li[41];
int ri[41];
long long km[40];
long long dp[40][2][2][2][2];
long long g(int nb,int lx,int rx,int ly,int ry){
	if(nb<0) return 1;
	if(dp[nb][lx][rx][ly][ry]!=-1){
		return dp[nb][lx][rx][ly][ry];
	}

	else if(lx&&ly&&rx&&ry){
		dp[nb][lx][rx][ly][ry]=km[nb+1];
		return dp[nb][lx][rx][ly][ry];
	}
	else{
		long long ans=0;
		for(int i=0;i<2;i++){
			for(int j=0;j<2;j++){
				if(i&&j) continue;
				if(!lx&&i<li[nb]) continue;
				if(!ly&&j<li[nb]) continue;
				if(!rx&&i>ri[nb]) continue;
				if(!ry&&j>ri[nb]) continue;
				ans+=g(nb-1,lx|(i>li[nb]),rx|(i<ri[nb]),ly|(j>li[nb]),ry|(j<ri[nb]));
			}
		}
		dp[nb][lx][rx][ly][ry]=ans;
		return ans;
	}
}
int main(){
	int T;
	scanf("%d",&T);
	km[0]=1;
	for(int i=1;i<=32;i++){
		km[i]=3*km[i-1];
	}
	while(T--){
		scanf("%d%d",&l,&r);
		memset(dp,-1,sizeof(dp));
		for(int i=0;i<31;i++){
			li[i]=(l>>i)&1;
			ri[i]=(r>>i)&1;
		}
		printf("%lld\n",g(30,0,0,0,0));
	}
}


//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
//#define double long double
//#define double float
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200060;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;

long long gcd(long long x, long long y) {
	long long m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}

int dp[35][6];
void solve() {
	int l, r; cin >> l >> r;
	REP(i, 31)REP(j, 6)dp[i][j] = 0;
	dp[30][4] = 1;
	int ad = 0;
	if (l == 0) {
		ad++;
		if (r == 0) {
			print(1); return;
		}
		else l = 1;
	}
	REPR(k, 29) {
		bool bitR = r & (1LL << k);
		bool bitL = l & (1LL << k);
		if (bitR&&bitL) {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][3]*2;
			dp[k][1] += dp[k + 1][1]+dp[k+1][5];
			dp[k][3] += dp[k + 1][3];
		}
		else if (bitR) {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][1] + dp[k + 1][3] * 2+dp[k+1][5];
			dp[k][1] += dp[k + 1][1] * 2 + dp[k + 1][2]+dp[k+1][5];
			dp[k][2] += dp[k + 1][2] + dp[k + 1][4];
			dp[k][3] += dp[k + 1][3];// +dp[k + 1][4];
			dp[k][5] += dp[k + 1][4]+dp[k+1][5];
		}
		else if (bitL) {
			dp[k][0] += dp[k + 1][0] * 3;
			dp[k][1] += dp[k + 1][1];
			dp[k][3] += dp[k + 1][3] * 2;
			dp[k][5] += dp[k + 1][5];
		}
		else {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][1];
			dp[k][1] += dp[k + 1][1] * 2 + dp[k + 1][2];
			dp[k][2] += dp[k + 1][2];
			dp[k][3] += dp[k + 1][3] * 2+dp[k+1][5];
			dp[k][4] += dp[k + 1][4];
			dp[k][5] += dp[k + 1][5];
		}
		/*if (k <= 5) {
			cout << "k:" << k << endl;
			pe(bitL); print(bitR);
			REP(i, 6)print(dp[k][i]);
		}*/

	}
	ll ans = 0;
	/*REP(i, 6) {
		print(dp[0][i]);
	}*/
	ans += ad;
	ans += dp[0][0] * 2 + dp[0][1] * 2 + dp[0][2] + dp[0][3] * 2 + dp[0][4] + dp[0][5] * 2;
	print(ans);
}

int solve2(int l, int r) {
	int ans = 0;
	FOR(i, l, r + 1) {
		FOR(j, l, r + 1) {
			if ((i + j) == (i ^ j))ans++;
		}
	}
	return ans;
}

void test() {
	int l, r; cin >> l >> r;
	REP(i, 31)REP(j, 6)dp[i][j] = 0;
	dp[30][4] = 1;
	int ad = 0;
	if (l == 0) {
		ad++;
		if (r == 0) {
			print(1); return;
		}
		else l = 1;
	}
	REPR(k, 29) {
		bool bitR = r & (1LL << k);
		bool bitL = l & (1LL << k);
		/*if (k <= 5) {
			cout << "k:" << k << endl;
			pe(bitL); print(bitR);
			REP(i, 6)print(dp[k][i]);
		}*/
		if (bitR&&bitL) {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][3] * 2;
			dp[k][1] += dp[k + 1][1] + dp[k + 1][5];
			dp[k][3] += dp[k + 1][3];
		}
		else if (bitR) {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][1] + dp[k + 1][3] * 2 + dp[k + 1][5];
			dp[k][1] += dp[k + 1][1] * 2 + dp[k + 1][2] + dp[k + 1][5];
			dp[k][2] += dp[k + 1][2] + dp[k + 1][4];
			dp[k][3] += dp[k + 1][3];// +dp[k + 1][4];
			dp[k][5] += dp[k + 1][4] + dp[k + 1][5];
		}
		else if (bitL) {
			dp[k][0] += dp[k + 1][0] * 3;
			dp[k][1] += dp[k + 1][1];
			dp[k][3] += dp[k + 1][3] * 2;
			dp[k][5] += dp[k + 1][5];
		}
		else {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][1];
			dp[k][1] += dp[k + 1][1] * 2 + dp[k + 1][2];
			dp[k][2] += dp[k + 1][2];
			dp[k][3] += dp[k + 1][3] * 2 + dp[k + 1][5];
			dp[k][4] += dp[k + 1][4];
			dp[k][5] += dp[k + 1][5];
		}
		if (k <= 5) {
		cout << "k:" << k << endl;
		//pe(bitL); print(bitR);
		//REP(i, 6)print(dp[k][i]);
		}

	}
	ll ans = 0;
	/*REP(i, 6) {
		print(dp[0][i]);
	}*/
	ans += ad;
	ans += dp[0][0] * 2 + dp[0][1] * 2 + dp[0][2] + dp[0][3] * 2 + dp[0][4] + dp[0][5] * 2;
	if (ans != solve2(l, r)) {
		cout << "Wrong Answer" << endl;
		print(ans);
		print(solve2(l, r));
		return;
	}
	else {
		print("OK");
		print(ans);
		print(solve2(l, r));
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int q; cin >> q;
	//while(q--)test();
	while (q--)solve();
}


//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
//#define double long double
//#define double float
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200060;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;

long long gcd(long long x, long long y) {
	long long m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}

int dp[35][6];
void solve() {
	int l, r; cin >> l >> r;
	REP(i, 31)REP(j, 6)dp[i][j] = 0;
	dp[30][4] = 1;
	int ad = 0;
	/*if (l == 0) {
		ad++;
		if (r == 0) {
			print(1); return;
		}
		else l = 1;
	}*/
	REPR(k, 29) {
		bool bitR = r & (1LL << k);
		bool bitL = l & (1LL << k);
		if (bitR&&bitL) {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][3]*2;
			dp[k][1] += dp[k + 1][1]+dp[k+1][5];
			dp[k][3] += dp[k + 1][3];
		}
		else if (bitR) {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][1] + dp[k + 1][3] * 2 + dp[k + 1][5];
			dp[k][1] += dp[k + 1][1] * 2 + dp[k + 1][2] + dp[k + 1][5];
			dp[k][2] += dp[k + 1][2] + dp[k + 1][4];
			dp[k][3] += dp[k + 1][3];// +dp[k + 1][4];
			dp[k][5] += dp[k + 1][4]+dp[k+1][5];
		}
		else if (bitL) {
			dp[k][0] += dp[k + 1][0] * 3;
			dp[k][1] += dp[k + 1][1];
			dp[k][3] += dp[k + 1][3] * 2;
			dp[k][5] += dp[k + 1][5];
		}
		else {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][1];
			dp[k][1] += dp[k + 1][1] * 2 + dp[k + 1][2];
			dp[k][2] += dp[k + 1][2];
			dp[k][3] += dp[k + 1][3] * 2+dp[k+1][5];
			dp[k][4] += dp[k + 1][4];
			dp[k][5] += dp[k + 1][5];
		}
	}
	ll ans = 0;
	/*REP(i, 6) {
		print(dp[0][i]);
	}*/
	if (ad)ans += r + 1;
	ans += dp[0][0] * 2 + dp[0][1] * 2 + dp[0][2] + dp[0][3] * 2 + dp[0][4] + dp[0][5] * 2;
	print(ans);
}

int solve2(int l, int r) {
	int ans = 0;
	FOR(i, l, r + 1) {
		FOR(j, l, r + 1) {
			if ((i + j) == (i ^ j))ans++;
		}
	}
	return ans;
}

void test() {
	int l, r; cin >> l >> r;
	REP(i, 31)REP(j, 6)dp[i][j] = 0;
	dp[30][4] = 1;
	int ad = 0;
	if (l == 0) {
		ad++;
		if (r == 0) {
			print(1); return;
		}
		else l = 1;
	}
	REPR(k, 29) {
		bool bitR = r & (1LL << k);
		bool bitL = l & (1LL << k);
		/*if (k <= 5) {
			cout << "k:" << k << endl;
			pe(bitL); print(bitR);
			REP(i, 6)print(dp[k][i]);
		}*/
		if (bitR&&bitL) {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][3] * 2;
			dp[k][1] += dp[k + 1][1] + dp[k + 1][5];
			dp[k][3] += dp[k + 1][3];
		}
		else if (bitR) {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][1] + dp[k + 1][3] * 2 + dp[k + 1][5];
			dp[k][1] += dp[k + 1][1] * 2 + dp[k + 1][2] + dp[k + 1][5];
			dp[k][2] += dp[k + 1][2] + dp[k + 1][4];
			dp[k][3] += dp[k + 1][3];// +dp[k + 1][4];
			dp[k][5] += dp[k + 1][4] + dp[k + 1][5];
		}
		else if (bitL) {
			dp[k][0] += dp[k + 1][0] * 3;
			dp[k][1] += dp[k + 1][1];
			dp[k][3] += dp[k + 1][3] * 2;
			dp[k][5] += dp[k + 1][5];
		}
		else {
			dp[k][0] += dp[k + 1][0] * 3 + dp[k + 1][1];
			dp[k][1] += dp[k + 1][1] * 2 + dp[k + 1][2];
			dp[k][2] += dp[k + 1][2];
			dp[k][3] += dp[k + 1][3] * 2 + dp[k + 1][5];
			dp[k][4] += dp[k + 1][4];
			dp[k][5] += dp[k + 1][5];
		}
		if (k <= 5) {
		cout << "k:" << k << endl;
		//pe(bitL); print(bitR);
		//REP(i, 6)print(dp[k][i]);
		}

	}
	ll ans = 0;
	/*REP(i, 6) {
		print(dp[0][i]);
	}*/
	ans += ad;
	ans += dp[0][0] * 2 + dp[0][1] * 2 + dp[0][2] + dp[0][3] * 2 + dp[0][4] + dp[0][5] * 2;
	if (ans != solve2(l, r)) {
		cout << "Wrong Answer" << endl;
		print(ans);
		print(solve2(l, r));
		return;
	}
	else {
		print("OK");
		print(ans);
		print(solve2(l, r));
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int q; cin >> q;
	//while(q--)test();
	while (q--)solve();
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
int a[30],b[30];
ll dp[30][2][2];
ll dfs(int pos,bool limit,bool limit2)
{
    if(pos==-1) return 1;
    if(!limit&&!limit2&&dp[pos][limit][limit2]!=-1) return dp[pos][limit][limit2];
    int up1=limit ? a[pos] : 1;
    int up2=limit2?b[pos]:1;
    ll tmp=0;
    for(int i=0;i<=up1;i++)
    {
    	for(int j=0;j<=up2;j++) if(!(i&j)){
	        tmp+=dfs(pos-1,limit && i==a[pos],limit2&&j==b[pos]);
   		}
    }
    if(!limit&&!limit2) dp[pos][limit][limit2]=tmp;
    return tmp;
}
ll solve(ll x,ll y)
{
	if(x<0) return 0;
    int pos=0;
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    while(x)
    {
        a[pos++]=x%2;
        x/=2;
    }
    pos=0;
    while(y){
    	b[pos++]=y%2;
    	y/=2;
    }
    return dfs(pos-1,true,true);
}
int main(){
    int T;
    cin>>T;
    memset(dp,-1,sizeof dp);
    while(T--)
    {
    	ll le,ri;
    	scanf("%lld%lld",&le,&ri);
    	printf("%lld\n",solve(ri,ri)-2*solve(le-1,ri)+solve(le-1,le-1));
    }
    return 0;
}
/*0 1
1 1
10 2
11 1
100 4*/


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
int a[30],b[30];
ll dp[30][2][2];
ll dfs(int pos,bool limit,bool limit2)
{
    if(pos==-1) return 1;
    if(dp[pos][limit][limit2]!=-1) return dp[pos][limit][limit2];
    int up1=limit ? a[pos] : 1;
    int up2=limit2?b[pos]:1;
    ll tmp=0;
    for(int i=0;i<=up1;i++)
    {
    	for(int j=0;j<=up2;j++) if(!(i&j)){
	        tmp+=dfs(pos-1,limit && i==a[pos],limit2&&j==b[pos]);
   		}
    }
    dp[pos][limit][limit2]=tmp;
    return tmp;
}
ll solve(ll x,ll y)
{
	if(x<0) return 0;
    int pos=0;
    memset(dp,-1,sizeof dp);
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    while(x)
    {
        a[pos++]=x%2;
        x/=2;
    }
    pos=0;
    while(y){
    	b[pos++]=y%2;
    	y/=2;
    }
    return dfs(pos-1,true,true);
}
int main(){
    int T;
    cin>>T;
    while(T--)
    {
    	ll le,ri;
    	scanf("%lld%lld",&le,&ri);
    	printf("%lld\n",solve(ri,ri)-2*solve(le-1,ri)+solve(le-1,le-1));
    }
    return 0;
}
/*0 1
1 1
10 2
11 1
100 4*/


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int numOfFriends = scn.nextInt(), fenceHeight = scn.nextInt(), count = 0, n;

        for (int i = 0; i < numOfFriends; i++) {
            n = scn.nextInt();
            if (n > fenceHeight)
                count += 2;
            else
                count++;
        }
        System.out.println(count);
    }
}


package main;

import java.util.Scanner;

public class PS {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int numOfFriends = scn.nextInt();
        int fenceHeight = scn.nextInt();

        int count = 0;
        for (int i = 0; i < numOfFriends; i++) {
            int n = scn.nextInt();
            if(n > fenceHeight){
                count+=2;
            }else{
                count++;
            }
        }
        System.out.println(count);
    }
}


package main;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int numOfFriends = scn.nextInt();
        int fenceHeight = scn.nextInt();

        int count = 0;
        for (int i = 0; i < numOfFriends; i++) {
            int n = scn.nextInt();
            if(n > fenceHeight){
                count+=2;
            }else{
                count++;
            }
        }
        System.out.println(count);
    }
}


package A.VanyaAndFence;

import java.util.Scanner;

public class VanyaAndFence {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int friendNum = scanner.nextInt();
        int fenceHeight = scanner.nextInt();
        int minWidthOfRoad = 0;
        for (int i = 0; i < friendNum; i++) {
            int friendHeight = scanner.nextInt();
            if (friendHeight > fenceHeight)
                minWidthOfRoad += 2;
            else
                minWidthOfRoad += 1;
        }

        System.out.print(minWidthOfRoad);

    }
}


package A.VanyaAndFence;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class VanyaAndFence {
    public VanyaAndFence(String inputPath) {
        File input = new File(inputPath);
        try (Scanner scanner = new Scanner(input);) {
            int friendNum = scanner.nextInt();
            int fenceHeight = scanner.nextInt();
            int minWidthOfRoad = 0;
            for (int i = 0; i < friendNum; i++) {
                int friendHeight = scanner.nextInt();
                if (friendHeight > fenceHeight)
                    minWidthOfRoad += 2;
                else
                    minWidthOfRoad += 1;
            }

            System.out.print(minWidthOfRoad);

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new VanyaAndFence("G:\\intellij_idea_workspace\\CodeForces\\src\\A\\VanyaAndFence\\input.txt");
    }
}


package A.VanyaAndFence;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class VanyaAndFence {
    public VanyaAndFence(String inputPath) {
        File input = new File(inputPath);
        try (Scanner scanner = new Scanner(input);) {
            int friendNum = scanner.nextInt();
            int fenceHeight = scanner.nextInt();
            int minWidthOfRoad = 0;
            for (int i = 0; i < friendNum; i++) {
                int friendHeight = scanner.nextInt();
                if (friendHeight > fenceHeight)
                    minWidthOfRoad += 2;
                else
                    minWidthOfRoad += 1;
            }

            System.out.println(minWidthOfRoad);

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new VanyaAndFence("G:\\intellij_idea_workspace\\CodeForces\\src\\A\\VanyaAndFence\\input.txt");
    }
}


package A.VanyaAndFence;

import java.util.Scanner;

public class VanyaAndFence {
    public VanyaAndFence() {

        Scanner scanner = new Scanner(System.in);
        int friendNum = scanner.nextInt();
        int fenceHeight = scanner.nextInt();
        int minWidthOfRoad = 0;
        for (int i = 0; i < friendNum; i++) {
            int friendHeight = scanner.nextInt();
            if (friendHeight > fenceHeight)
                minWidthOfRoad += 2;
            else
                minWidthOfRoad += 1;
        }

        System.out.print(minWidthOfRoad);

    }

    public static void main(String[] args) {
        new VanyaAndFence();
    }
}


import java.util.Scanner;

public class VanyaAndFence {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int friendNum = scanner.nextInt();
        int fenceHeight =scanner.nextInt();
        int minWidthOfRoad = 0;
        for (int i = 0; i < friendNum; i++) {
            int friendHeight = scanner.nextInt();
            if (friendHeight > fenceHeight)
                minWidthOfRoad += 2;
            else
                minWidthOfRoad += 1;
        }

        System.out.println(minWidthOfRoad);
    }
}


package A;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class VanyaAndFence {
    public VanyaAndFence(String inputPath) {
        File input = new File(inputPath);
        try (Scanner scanner = new Scanner(input);) {
            int friendNum = scanner.nextInt();
            int fenceHeight = scanner.nextInt();
            int minWidthOfRoad = 0;
            for (int i = 0; i < friendNum; i++) {
                int friendHeight = scanner.nextInt();
                if (friendHeight > fenceHeight)
                    minWidthOfRoad += 2;
                else
                    minWidthOfRoad += 1;
            }

            System.out.println(minWidthOfRoad);

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new VanyaAndFence("G:\\intellij_idea_workspace\\CodeForces\\src\\A\\input.txt");
    }
}


package A.VanyaAndFence;

import java.util.Scanner;

public class VanyaAndFence {
    public VanyaAndFence() {

        Scanner scanner = new Scanner(System.in);
        int friendNum = Integer.parseInt(scanner.next());
        int fenceHeight = Integer.parseInt(scanner.next());
        int minWidthOfRoad = 0;
        for (int i = 0; i < friendNum; i++) {
            int friendHeight = Integer.parseInt(scanner.next());
            if (friendHeight > fenceHeight)
                minWidthOfRoad += 2;
            else
                minWidthOfRoad += 1;
        }

        System.out.print(minWidthOfRoad);

    }

    public static void main(String[] args) {
        new VanyaAndFence();
    }
}


import java.util.Scanner;

public class VenyaAndFence {

    public static void main(String[] args) {
        Scanner input = new Scanner (System.in);
        System.out.println("Enter the number of friends");
        int num =input.nextInt();
        System.out.println("Enter the number of fence");
        int h =input.nextInt();
        int width =0;
        int i;
        for (i=1; i<=num; i++){
        System.out.println("Enter the height of the person num"+1);
        int ai = input.nextInt();
        if (ai <= h)
            width +=1;
        else
            width +=2;
    }
        System.out.println("The width of the fence is equal to:"+width);

    }

}


import java.util.Scanner;

public class VenyaAndFence {

    public static void main(String[] args) {
        Scanner input = new Scanner (System.in);

        int num =input.nextInt();

        int h =input.nextInt();
        int width =0;
        int i;
        for (i=1; i<=num; i++){
        int ai = input.nextInt();
        if (ai <= h)
            width +=1;
        else
            width +=2;
    }
        System.out.println(width);

    }


import java.util.Scanner;

public class VenyaAndFence {

    public static void main(String[] args) {
        Scanner input = new Scanner (System.in);
        int num =input.nextInt() , h =input.nextInt(), width =0;
        for (int i=1; i<=num; i++){
        int ai = input.nextInt();
        if (ai <= h)
            width +=1;
        else
            width +=2;
    }
        System.out.println(width);

    }

}


import java.util.Scanner;

public class VenyaAndFence {

    public static void main(String[] args) {
        Scanner input = new Scanner (System.in);
        int num =input.nextInt() ,int h =input.nextInt();
        int width =0;
        int i;
        for (i=1; i<=num; i++){
        int ai = input.nextInt();
        if (ai <= h)
            width +=1;
        else
            width +=2;
    }
        System.out.println(width);

    }

}


import java.util.Scanner;

public class VenyaAndFence {

    public static void main(String[] args) {
        Scanner input = new Scanner (System.in);

        int num =input.nextInt();

        int h =input.nextInt();
        int width =0;
        int i;
        for (i=1; i<=num; i++){
        int ai = input.nextInt();
        if (ai <= h)
            width +=1;
        else
            width +=2;
    }
        System.out.println("The width of the fence is equal to:"+width);

    }

}


import java.util.Scanner;

public class problem {

public static void main(String[] args) {
        int n,h,w=0 , s;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();

       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           s =input.nextInt();
           if (s <=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication9;

import java.util.Scanner;

/**
 *
 * @author alhmed
 */
public class JavaApplication9 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
     int n , h , h1,counter;
     counter=0;
     Scanner s = new Scanner(System.in);
     n = s.nextInt();
     h = s.nextInt();
     for(int i = 0 ; i < n;i++)
     {
        h1 = s.nextInt();
        if(h1>h)
            counter+=2;
        else

            counter++;

            }
     System.out.println(counter);
    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package problem.solving;

import java.util.Scanner;

/**
 *
 * @author i7
 */
public class ProblemSolving {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
                  System.out.println(n+" "+h+"\n");

       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           arr[i]=input.nextInt();
           if (arr[i]<=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }

}


public class ProblemSolving {

    public static void main(String[] args) {
        int n,h,w=0 , s;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
                  System.out.println(n+" "+h+"\n");

       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           s =input.nextInt();
           if (s <=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }

}


public class problem {

public static void main(String[] args) {
        int n,h,w=0 , s;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();

       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           s =input.nextInt();
           if (s <=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }}


package problem.solving;

import java.util.Scanner;

public class ProblemSolving {

    public static void main(String[] args) {
        int n,h,w=0;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
                  System.out.println(n+" "+h+"\n");

       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           arr[i]=input.nextInt();
           if (arr[i]<=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }

}


public class NewClass {
     public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
                  System.out.println(n+" "+h+"\n");

       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           arr[i]=input.nextInt();
           if (arr[i]<=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }

}


package test;
import java.util.*;

public class test {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner IN = new Scanner(System.in);
		int n = IN.nextInt();
		int	h = IN.nextInt();
		int len = 0;
		int x ;

		for (int i = 1; i<=n; i++){
			x = IN.nextInt();
			if(x>h)
				len ++;
			len ++;
		}

		System.out.println(len);

}
}


//package test;
import java.util.Scanner;

public class test {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner IN = new Scanner(System.in);
		int n,h,len,x;
		n = IN.nextInt();
		h = IN.nextInt();
		len = 0;
		for (int i = 1; i<=n; i++){
			x = IN.nextInt();
			if(x>h)
				len++;
			len++;
		}
		System.out.println(len);

}
}


package test;
import java.util.*;

public class test {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner IN = new Scanner(System.in);
		System.out.print("enter n and h : ");
		int n = IN.nextInt();
		int	h = IN.nextInt();
		int len = 0;
		int x ;

		for (int i = 1; i<=n; i++){
			x = IN.nextInt();
			if(x>h)
				len ++;
			len ++;
		}

		System.out.println(len);

}
}


package test;
import java.util.*;

public class test {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner IN = new Scanner(System.in);
		int n,h,len,x;
		n = IN.nextInt();
		h = IN.nextInt();
		len = 0;
		for (int i = 1; i<=n; i++){
			x = IN.nextInt();
			if(x>h)
				len ++;
			len ++;
		}
		System.out.println(len);

}
}


package test;
import java.util.Scanner;

public class test {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner IN = new Scanner(System.in);
		int n,h,len,x;
		n = IN.nextInt();
		h = IN.nextInt();
		len = 0;
		for (int i = 1; i<=n; i++){
			x = IN.nextInt();
			if(x>h)
				len ++;
			len ++;
		}
		System.out.println(len);

}
}


package problem.solving;

import java.util.Scanner;

public class ProblemSolving {

    public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0,s;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();

       for(int i=0;i<n;i++)
       {
           s=input.nextInt();
       if (s<=h)
               w++;
           else
               w+=2;
       }

       System.out.print(w);
    }

}


package problem.solving;

import java.util.Scanner;

/**
 *
 * @author i7
 */
public class ProblemSolving {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
                  System.out.println(n+" "+h);

       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           arr[i]=input.nextInt();
       if (arr[i]<=h)
               w++;
           else
               w+=2;
       }
       for(int i=0;i<n;i++)
       {
           System.out.print(arr[i]);
       }
       System.out.println("\n"+w);
    }

}


import java.util.Scanner;

/**
 *
 * @author i7
 */
public class ProblemSolving {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0,s;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();

       for(int i=0;i<n;i++)
       {
           s=input.nextInt();
       if (s<=h)
               w++;
           else
               w+=2;
       }

       System.out.println(w);
    }

}


package problem.solving;

import java.util.Scanner;

/**
 *
 * @author i7
 */
public class ProblemSolving {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
                  System.out.println(n+" "+h);

       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           arr[i]=input.nextInt();
           if (arr[i]<=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }

}


package problem.solving;

import java.util.Scanner;

/**
 *
 * @author i7
 */
public class ProblemSolving {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
           int [] arr=new int[1003];
       for(int i=0;i<n;i++)
       {
           arr[i]=input.nextInt();
       if (arr[i]<=h)
               w++;
           else
               w+=2;
       }

       System.out.println(w);
    }

}


import java.util.Scanner;

public class ProblemSolving {

    public static void main(String[] args) {
        int n,h,w=0 , s;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
                  System.out.println(n+" "+h+"\n");

       for(int i=0;i<n;i++)
       {
           s =input.nextInt();
           if (s <=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }

}


package problem.solving;

import java.util.Scanner;

/**
 *
 * @author i7
 */
public class ProblemSolving {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0,s;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
                  System.out.println(n+" "+h);

       //int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           s=input.nextInt();
           if (s<=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }

}


package problem.solving;

import java.util.Scanner;

public class ProblemSolving {

    public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0,s;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();

       for(int i=0;i<n;i++)
       {
           s=input.nextInt();
       if (s<=h)
               w++;
           else
               w+=2;
       }

       System.out.println(w);
    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package problem.solving;

import java.util.Scanner;

/**
 *
 * @author i7
 */
public class ProblemSolving {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int n,h,w=0;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           arr[i]=input.nextInt();
           if (arr[i]<=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }

}


import java.util.Scanner;

public class ProblemSolving {

    public static void main(String[] args) {
        int n,h,w=0 , s;
            Scanner input = new Scanner(System.in);
           n=input.nextInt();
           h=input.nextInt();
                  System.out.println(n+" "+h+"\n");

       int [] arr=new int[n];
       for(int i=0;i<n;i++)
       {
           s =input.nextInt();
           if (s <=h)
               w++;
           else
               w+=2;
       }
       System.out.println(w);
    }

}


import java.util.Scanner;

public class test {

	public static Scanner myScanner = new Scanner(System.in);

	public static void main(String[] args) {

		int n = myScanner.nextInt();
		int h = myScanner.nextInt();
		int[] arr = new int[n];
		int result = 0;
		for(int X = 0; X < n ; X++) {
			arr[X] = myScanner.nextInt();
		}

		for(int X = 0; X < n; X++) {
			if(arr[X] <= h) result++;
			else result += 2;
		}
		System.out.println(result);
	}

}


import java.util.Scanner;

public class Test {

	public static Scanner myScanner = new Scanner(System.in);

	public static void main(String[] args) {
		int n, h;

		n = myScanner.nextInt();
		h = myScanner.nextInt();
		int[] numOfFriends = new int[n];
		int minimumWidth = 0;
		for(int p = 0; p < n; p++) {
			numOfFriends[p] = myScanner.nextInt();
			if(numOfFriends[p] <= h) minimumWidth++;
			else minimumWidth += 2;
		}

System.out.println(minimumWidth);
	}
}


import java.util.Scanner;

public class Test{

	public static Scanner myScanner = new Scanner(System.in);

	public static void main(String[] args) {
		int n, h;

		System.out.print("Enter number of friends:");
		n = myScanner.nextInt();
		System.out.print("Enter height of the fence:");
		h = myScanner.nextInt();
		int[] numOfFriends = new int[n];
		int minimumWidth = 0;
		for(int p = 0; p < n; p++) {
			numOfFriends[p] = myScanner.nextInt();
			if(numOfFriends[p] <= h) minimumWidth++;
			else minimumWidth += 2;
		}

System.out.println(minimumWidth);
	}
}


package CF_A;

import java.util.Scanner;

public class CF677_D2_A_Vanya_and_Fence {

	public static Scanner myScanner = new Scanner(System.in);

	public static void main(String[] args) {

		System.out.print("Enter n & h :"); //the number of friends and the height of the fence
		int n = myScanner.nextInt();
		int h = myScanner.nextInt();
		int[] arr = new int[n];
		int result = 0;
		for(int X = 0; X < n ; X++) {
			System.out.print("Enter person " + (X+1) + " height :" );
			arr[X] = myScanner.nextInt();
		}

		for(int X = 0; X < n; X++) {
			if(arr[X] <= h) result++;
			else result += 2;
		}
		System.out.println(result);
	}

}


import java.util.Scanner;

public class test {

	public static Scanner myScanner = new Scanner(System.in);

	public static void main(String[] args) {

		System.out.print("Enter n & h :"); //the number of friends and the height of the fence
		int n = myScanner.nextInt();
		int h = myScanner.nextInt();
		int[] arr = new int[n];
		int result = 0;
		for(int X = 0; X < n ; X++) {
			System.out.print("Enter person " + (X+1) + " height :" );
			arr[X] = myScanner.nextInt();
		}

		for(int X = 0; X < n; X++) {
			if(arr[X] <= h) result++;
			else result += 2;
		}
		System.out.println(result);
	}

}


   import java.util.Scanner;

public class A{

    public static void main (String[]args){
	           Scanner scan = new Scanner(System.in);
			   int n = scan.nextInt();
			   int h = scan.nextInt();

			   int answer =0;

			   for (int i=0; i<n; i++){
			       int a = scan.nextInt();

				   if (n > h) answer+= 2;
				   else answer++;
				   }

			   System.out.println(answer);

			   }


impor java.util.Scanner;

public class Main{

    public static void main (String[]args){
	           Scanner scan = new Scanner(System.in);
			   int n = scan.nextInt();
			   int h = scan.nextInt();

			   long answer =0;

			   for (int i =0;i<n;i++){
			       int a = scan.nextInt();

				   if (a > h) answer+= 2;
				   else answer++;
				   }

			   System.out.println(answer);

			   }

}


impor java.util.;

public class Main{

    public static void main (String[]args){
	           Scanner scan = new Scanner(System.in);
			   int n = scan.nextInt();
			   int h = scan.nextInt();

			   long answer =0;

			   for (int i =0;i<n;i++){
			       int a = scan.nextInt();

				   if (a > h) answer+= 2;
				   else answer++;
				   }

			   System.out.println(answer);

			   }

}


import java.util.Scanner;

public class A{

    public static void main (String[]args){
	          Scanner sc = new Scanner(System.in);
			int ancho=0;
              String strn = sc.nextLine;
             	String strh = sc.nextLine;

              String arrayn []= strn.split(" ");
			   String arrayh []= strn.split(" ");

			  int numbers [] = new int [arrayn.length];
			  int numbersB [] = new int [arrayh.length];

			  for(int i=0; i<arrayn.length;i++){
			  numbers[i]=integer.parseInt(arrayn[i]);
			  }
			  for (int i=0; i<numbersB.length;i++){
			    if (numbersB[i]<=numbers[1]){
				}else{
				      ancho=ancho+2;
					  }
					  }

					  System.out.println(ancho);
					  }

			  }

}


import java.util.Scanner;

public class A{

    public static void main(String[]args){
	          Scanner in = new Scanner(System.in);
	int n=in.nextint(),h=in.nextint(),persona,suma=0;

	for(int i=0;i<n;i++)
    {
	persona=in.nextint();
	if(persona>h)
	  suma+=2;
	  else
	  suma++;
	  }
	  System.out.println(suma);
	  }
}


impor java.util.Scanner;

public class A{

    public static void main (String[]args){
	           Scanner scan = new Scanner(System.in);
			   int n = scan.nextInt();
			   int h = scan.nextInt();

			   long answer =0;

			   for (int i =0;i<n;i++){
			       int a = scan.nextInt();

				   if (a > h) answer+= 2;
				   else answer++;
				   }

			   System.out.println(answer);

			   }

}


import java.util.Scanner;

public class A{

    public static void main(String[]args){
	          Scanner sc = new Scanner(System.in);
			int ancho=0;
              String strn = sc.nextLine();
             	String strh = sc.nextLine();

              String arrayn []= strn.split(" ");
			   String arrayh []= strh.split(" ");

			  int numbers [] = new int [arrayn.length];
			  int numbersB [] = new int [arrayh.length];

			  for(int i=0; i<arrayn.length;i++){
			  numbers[i]=integer.parseInt(arrayn[i]);
			  }
			  for (int i=0; i<numbersB.length;i++){
			    if (numbersB[i]<=numbers[1]){
				ancho = ancho +1;
				}else{
				      ancho=ancho+2;
					  }
					  }

					  System.out.println(ancho);
					  }

			  }


import java.util.Scanner;
/**
 *
 * @author CesarAlfonsoMendoza
 */
public class A {

    public static void main(String[]args){
	          Scanner in = new Scanner(System.in);
	int n=in.nextInt(),h=in.nextInt(),persona,suma=0;

	for(int i=0;i<n;i++)
    {
	persona=in.nextInt();
	if(persona>h)
	  suma+=2;
	  else
	  suma++;
	  }
	  System.out.println(suma);
	  }
}


impor.java.util.Scanner;

public class A{

    public static void main (String[]args){
	           Scanner scan = new Scanner(System.in);
			   int n = scan.nextInt();
			   int h = scan.nextInt();

			   long answer =0;

			   for (int i =0;i<n;i++){
			       int a = scan.nextInt();

				   if (a > h) answer+= 2;
				   else answer++;
				   }

			   System.out.println(answer);

			   }

}


impor java.util.Scanner;

public class A{

    public static void main (String[]args){
	          Scanner sc = new Scanner(System.in);
			int ancho=0;
              String strn = sc.nextLine;
             	String strh = sc.nextLine;

              String arrayn []= strn.split(" ");
			   String arrayh []= strn.split(" ");

			  int numbers [] = new int [arrayn.length];
			  int numbersB [] = new int [arrayh.length];

			  for(int i=0; i<arrayn.length;i++){
			  numbers[i]=integer.parseInt(arrayn[i]);
			  }
			  for (int i=0; i<numbersB.length;i++){
			    if (numbersB[i]<=numbers[1]){
				}else{
				      ancho=ancho+2;
					  }
					  }

					  System.out.println(ancho);
					  }

			  }


   import java.util.Scanner;

public class A{

    public static void main (String[]args){
	           Scanner scan = new Scanner(System.in);
			   int n = scan.nextInt();
			   int h = scan.nextInt();

			   int answer =0;

			   for (int i=0; i<n; i++){
			       int a = scan.nextInt();

				   if (a > h) answer+= 2;
				   else answer++;
				   }

			   System.out.println(answer);

			   }


import java.util.Scanner;

public class A{

    public static void main (String[]args){
	           Scanner scan = new Scanner(System.in);
			   int n = scan.nextInt();
			   int h = scan.nextInt();

			   int answer=0;

			   for (int i=0; i<n; i++){
			       int a = scan.nextInt();

				   if (n > h){ answer+= 2;
				   }else{ answer++;
				   }

			   System.out.println(answer);

			   }
			   }
			   }


import java.util.Scanner;

public class A{

    public static void main(String[]args){
	          Scanner in = new Scanner(System.in);
	int n=in.nexint(),h=in.nextint(),persona,suma=0;

	for(int i=0;i<n;i++)
    {
	persona=in.nextint();
	if(persona>h)
	  suma+=2;
	  else
	  suma++;
	  }
	  System.out.println(suma);
	  }
}


package com.company;

import java.util.Scanner;

public class Main {

    private static int PersonsNumber;
    private static int FenceHeight ;
    private static int RoadSize = 0 ;

    public static void main(String[] args) {
	// write your code here
        Scanner myObj = new Scanner(System.in);
        System.out.println("Persons Number");
        PersonsNumber =  myObj.nextInt();
        System.out.println("Fence Height");
        FenceHeight = myObj.nextInt();

        for (int i = 0 ; i<PersonsNumber ; i++){
            System.out.println("Person "+i+" Height ");
            if (myObj.nextInt() > FenceHeight) RoadSize++;
            RoadSize++;
        }

        System.out.println("Road Width = " + RoadSize);

    }
}


package com.company;

import java.util.Scanner;

public class Main {

    private static int PersonsNumber;
    private static int FenceHeight ;
    private static int RoadSize = 0 ;

    public static void main(String[] args) {
	// write your code here
        Scanner myObj = new Scanner(System.in);
        PersonsNumber =  myObj.nextInt();
        FenceHeight = myObj.nextInt();

        for (int i = 0 ; i<PersonsNumber ; i++){
            if (myObj.nextInt() > FenceHeight) RoadSize++;
            RoadSize++;
        }

        System.out.println(RoadSize);

    }
}


import java.util.Scanner;

public class Main {

         private static int PersonsNumber;
        private static int FenceHeight ;
        private static int RoadSize = 0 ;

        public static void main(String[] args) {
            // write your code here
            Scanner myObj = new Scanner(System.in);
            PersonsNumber =  myObj.nextInt();
            FenceHeight = myObj.nextInt();

            for (int i = 0 ; i<PersonsNumber ; i++){
                if (myObj.nextInt() > FenceHeight) RoadSize++;
                RoadSize++;
            }

            System.out.println(RoadSize);

    }
}


import java.util.Scanner;

public class Main {

    private static int RoadSize = 0 ;

    public static void main(String[] args) {
        // write your code here
        Scanner myObj = new Scanner(System.in);
        int personsNumber = myObj.nextInt();
        int fenceHeight = myObj.nextInt();

        for (int i = 0; i< personsNumber; i++){
            if (myObj.nextInt() > fenceHeight) RoadSize++;
            RoadSize++;
        }

        System.out.println(RoadSize);

    }
}


public class Main {

    private static int RoadSize = 0 ;

    public static void main(String[] args) {
        // write your code here
        Scanner myObj = new Scanner(System.in);
        int personsNumber = myObj.nextInt();
        int fenceHeight = myObj.nextInt();

        for (int i = 0; i< personsNumber; i++){
            if (myObj.nextInt() > fenceHeight) RoadSize++;
            RoadSize++;
        }

        System.out.println(RoadSize);

    }
}


package com.company;

import java.util.Scanner;

public class Main {

    private static int RoadSize = 0 ;

    public static void main(String[] args) {
        // write your code here
        Scanner myObj = new Scanner(System.in);
        int personsNumber = myObj.nextInt();
        int fenceHeight = myObj.nextInt();

        for (int i = 0; i< personsNumber; i++){
            if (myObj.nextInt() > fenceHeight) RoadSize++;
            RoadSize++;
        }

        System.out.println(RoadSize);

    }
}


import java.util.Scanner;

public class Cf_677_A {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n  = sc.nextInt(), h = sc.nextInt();
		int sum = 0;
		for(int i = 0; i < n; i++)
		{
			int num = sc.nextInt();
			if(num <= h)
				sum += 1;
			else if(num > h)
				sum+= 2;
		}
		System.out.print(sum);

	}

}


        import java.util.Scanner;
        import java.io.PrintWriter;

public class VanyaandFence {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int n = in.nextInt(), h = in.nextInt();
        int sum = 0;
        for(int i=0;i<n;i++)
        {
            int x = in.nextInt();
            if(x > h)
                sum += 2;
            else
                sum++;
        }
        out.print(sum);
        out.flush();
        out.close();
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mohanad
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        VanyaandFence solver = new VanyaandFence();
        solver.solve(1, in, out);
        out.close();
    }

    static class VanyaandFence {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt(), h = in.nextInt();
            int sum = 0;
            for (int i = 0; i < n; i++) {
                int x = in.nextInt();
                if (x > h)
                    sum += 2;
                else
                    sum++;
            }
            out.print(sum);
            out.flush();
            out.close();
        }

    }
}


import java.util.Arrays;
import java.util.Scanner;

public class practice {

	public static void main(String [] args){
	Scanner sc =new Scanner(System.in);
	int n = sc.nextInt();
	int h = sc.nextInt();
	int sum = 0;
	for(int i = 0; i< n; i++){
		int b = sc.nextInt();
		if(b <= h)
			sum += 1;
		else
			sum+=2;
	}
	System.out.println(sum);
	}
}


import java.util.Scanner;
public class Sol
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int h=s.nextInt();
        int a[]=new int[n];
        int count=0;
        for(int i=0;i<n;i++)
        a[i]=s.nextInt();
        for(int k=0;k<n;k++)
        {
            if(arr[k]>h)
            count++;
        }
        System.out.println((h-count)+(count*2));

    }
}


import java.util.Scanner;
public class Sol
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int h=s.nextInt();
        int a[]=new int[n];
        int count=0;
        for(int i=0;i<n;i++)
        a[i]=s.nextInt();
        for(int k=0;k<n;k++)
        {
            if(arr[k)>h)
            count++;
        }
        System.out.println((h-count)+(count*2));

    }
}


import java.util.Scanner;
public class Sol
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int h=s.nextInt();
        int a[]=new int[n];
        int count=0;
        for(int i=0;i<n;i++)
        a[i]=s.nextInt();
        for(int k=0;k<n;k++)
        {
            if(a[k]>h)
            count++;
        }
        System.out.println((h-count)+(count*2));

    }
}


import java.util.Scanner;
public class Sol
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int h=s.nextInt();
        int a[]=new int[n];
        int count=0;
        for(int i=0;i<n;i++)
        a[i]=s.nextInt();
        for(int k=0;k<n;k++)
        {
            if(a[k]>h)
            count++;
        }
        System.out.println((n-count)+(count*2));

    }
}


import java.util.Scanner;

public class CF {
    public static void main(String[] args) {
      Scanner input= new Scanner(System.in);
      long maxH;
      int n = input.nextInt();
      int h = input.nextInt();

          maxH = n;
          for(int i = 0 ; i < n ; i++){
              int a = input.nextInt();
              if(a > h)
                  maxH++;
          }
      System.out.println(maxH);

    }

}


package cf;

import java.util.Scanner;

public class CF {
    public static void main(String[] args) {
      Scanner input= new Scanner(System.in);
      long maxH;
      int n = input.nextInt();
      int h = input.nextInt();
      if( n < 1 || n > 1000)
          System.out.println(0);
      else if( h < 1 || n > 1000)
          System.out.println(0);
      else{
          maxH = n;
          for(int i = 0 ; i < n ; i++){
              int a = input.nextInt();
              if(a >= 1 && a <= 2*h && a > h)
                  maxH++;
          }
      System.out.println(maxH);
      }
    }

}


package cf;

import java.util.Scanner;

public class CF {
    private static Scanner input= new Scanner(System.in);

    public static void main(String[] args) {

      int n = input.nextInt();
      int h = input.nextInt();
      System.out.println(maxH(n,h));

    }
    public static int maxH(int n, int h){
        int maxH = n;
      if( n < 1 || n > 1000) return 0;
      if( h < 1 || n > 1000) return 0;
      int [] a = new int[n];
      for(int i = 0 ; i < n ; i++){
          a[i] = input.nextInt();
          if(a[i]>h)
              maxH++;
      }
      return maxH;
    }
}


package cf;

import java.util.Scanner;

public class CF {
    private static Scanner input= new Scanner(System.in);

    public static void main(String[] args) {

      int n = input.nextInt();
      int h = input.nextInt();
      System.out.println(maxH(n,h));

    }
    public static int maxH(int n, int h){
        int maxH = n;
      if( n < 1 || n > 1000) System.exit(1);
      if( h < 1 || n > 1000) System.exit(1);
      int [] a = new int[n];
      for(int i = 0 ; i < n ; i++){
          a[i] = input.nextInt();
          if(a[i]>h)
              maxH++;
      }
      return maxH;
    }
}


package cf;

import java.util.Scanner;

public class CF {
    public static void main(String[] args) {
      Scanner input= new Scanner(System.in);
      long maxH;
      int n = input.nextInt();
      int h = input.nextInt();

          maxH = n;
          for(int i = 0 ; i < n ; i++){
              int a = input.nextInt();
              if(a > h)
                  maxH++;
          }
      System.out.println(maxH);

    }

}


package cf;

import java.util.Scanner;

public class CF {
    public static void main(String[] args) {

      Scanner input= new Scanner(System.in);

      int n = input.nextInt();
      int h = input.nextInt();
      long maxH = n;
          for(int i = 0 ; i < n ; i++){
              int a = input.nextInt();
              if(a > h)
                  maxH++;
          }
      System.out.println(maxH);

    }
}


import java.util.Scanner;

public class fences {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner (System.in);
		//takes in an input let first one a be the number of people and b be the height of the fence
		int a = scan.nextInt();
		int b = scan.nextInt();

		Scanner lines = new Scanner(System.in); //reads in second input
		String s = lines.next();
		s += lines.nextLine();

		//System.out.println(s);
		String [] character = s.split(" "); //splits second input
		int [] numbers = new int[a];  //new array to make sure we're dealing with integers

		for(int x = 0; x<character.length ; x++) {
			numbers[x] = Integer.parseInt(character[x]);
		}
		int counter = 0;
		for (int i = 0; i< numbers.length; i++) {
			if (numbers[i]>b) {counter+=2;}
			else if (numbers[i]<=b) {counter+=1;}
		}
		System.out.println(counter);

		//System.out.println(character[0]);

	}

}


package hackerrank;

import java.util.Scanner;

public class fences {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner (System.in);
		//takes in an input let first one a be the number of people and b be the height of the fence
		int n = scan.nextInt();
		int h = scan.nextInt();
		int sum =0;
        int arr[] = new int [n];
        for(short i=0;i<n;i++)
        {
            arr[i]=scan.nextInt();
            if(arr[i]<=h)
                sum+=1;
            else
                sum+=2;
        }
        System.out.println(sum);
    }

	}


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int h=in.nextInt();
        int sum=0;
        for(int i=0;i<n;i++) {
            if(in.nextInt()>h)
                sum+=2;
            else
                sum+=1;
        }
        System.out.println(sum);

    }


package hackerrank;

import java.util.Scanner;

public class fences {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner (System.in);
		//takes in an input let first one a be the number of people and b be the height of the fence
		int a = scan.nextInt();
		int b = scan.nextInt();

		Scanner lines = new Scanner(System.in); //reads in second input
		String s = lines.next();
		s += lines.nextLine();

		//System.out.println(s);
		String [] character = s.split(" "); //splits second input
		int [] numbers = new int[a];  //new array to make sure we're dealing with integers

		for(int x = 0; x<character.length ; x++) {
			numbers[x] = Integer.parseInt(character[x]);
		}
		int counter = 0;
		for (int i = 0; i< numbers.length; i++) {
			if (numbers[i]>b) {counter+=2;}
			else if (numbers[i]<=b) {counter+=1;}
		}
		System.out.println(counter);

		//System.out.println(character[0]);

	}

}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner (System.in);
		//takes in an input let first one a be the number of people and b be the height of the fence
		int n = scan.nextInt();
		int h = scan.nextInt();
		int sum =0;
        int arr[] = new int [n];
        for(short i=0;i<n;i++)
        {
            arr[i]=scan.nextInt();
            if(arr[i]<=h)
                sum+=1;
            else
                sum+=2;
        }
        System.out.println(sum);
    }

}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt(), h = input.nextInt(),sum=0;
        for(int i=0; i<n; i++){
            int x= input.nextInt()
            if(x<=h)
                sum ++;
            else sum =sum+2;
        }
        System.out.println(sum);
    }
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt(), h = input.nextInt(),sum=0;
        int []a = new int[n];
        for(int i=0; i<n; i++){
            a[i]=input.nextInt();
        }
        for(int i=0; i<n; i++){
            if(a[i]<=h)
                sum ++;
            else sum =sum+2;
        }
        System.out.println(sum);
    }
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt(), h = input.nextInt(),sum=0;
        for(int i=0; i<n; i++){
            int x= input.nextInt();
            if(x<=h)
                sum ++;
            else sum =sum+2;
        }
        System.out.println(sum);
    }
}


import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt(), h = input.nextInt(),sum=0;
        for(int i=0; i<n; i++){
            int x= input.nextInt();
            if(x>h)
                sum ++;
            sum++;
        }
        System.out.println(sum);
    }
}


package vanya.and.fence;

import java.io.*;
import java.util.*;

public class Main{
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Solution
      int n = sc.nextInt(),h = sc.nextInt();
      List<Integer> a = new ArrayList<Integer>();
      long count = 0;

      for (int i = 0; i<n ; i++) {
    	  a.add(sc.nextInt());
    	  if (a.get(i) > h)
    		  count++;
      }

      //long count = a.stream().filter(num -> num>h).count();
      out.println(count + a.size());
      // Solution end
      out.close();
   }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;
   //--------------------------------------------------------
}


import java.io.*;
import java.util.*;

public class Main{
   public static void main(String[] args) {
      MyScanner sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Start writing your solution here. -------------------------------------

      int n = sc.nextInt(), h = sc.nextInt();
      int cnt = n;
      for (int i=0; i<n; i++) {
    	  int hs = sc.nextInt();
    	  if (hs>h)
    		  cnt++;
      }
      out.println(cnt);
      // Stop writing your solution here. -------------------------------------
      out.close();
   }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;

   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
   //--------------------------------------------------------
}


import java.io.*;
import java.util.*;

public class Main{
   public static void main(String[] args) {
      MyScanner sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Solution
      int n = sc.nextInt(),h = sc.nextInt();
      List<Integer> a = new ArrayList<Integer>();

      for (int i = 0; i<n ; i++) {
    	  a.add(sc.nextInt());
      }

      long count = a.stream().filter(num -> num>h).count();
      out.println(count + a.size());
      // Solution end
      out.close();
   }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;

   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
   //--------------------------------------------------------
}


package vanya.and.fence;

import java.io.*;
import java.util.*;

public class Main{
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Solution
      int n = sc.nextInt(),h = sc.nextInt();
      List<Integer> a = new ArrayList<Integer>();

      for (int i = 0; i<n ; i++) {
    	  a.add(sc.nextInt());
      }

      long count = a.stream().filter(num -> num>h).count();
      out.println(count + a.size());
      // Solution end
      out.close();
   }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;
   //--------------------------------------------------------
}


import java.io.*;
import java.util.*;

public class Main{
   public static void main(String[] args) {
      MyScanner sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Start writing your solution here. -------------------------------------

      int n = sc.nextInt(), h = sc.nextInt();
      List<Integer> hs = new ArrayList<Integer>();
      int cnt = h;
      for (int i=0; i<n; i++) {
    	  hs.add(sc.nextInt());
    	  if (hs.get(i)>h)
    		  cnt++;
      }
      out.println(cnt);
      // Stop writing your solution here. -------------------------------------
      out.close();
   }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;

   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
   //--------------------------------------------------------
}


import java.io.*;
import java.util.*;

public class Main{
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Solution
      int n = sc.nextInt(),h = sc.nextInt();
      List<Integer> a = new ArrayList<Integer>();
      long count = 0;

      for (int i = 0; i<n ; i++) {
    	  a.add(sc.nextInt());
    	  if (a.get(i) > h)
    		  count++;
      }

      //long count = a.stream().filter(num -> num>h).count();
      out.println(count + a.size());
      // Solution end
      out.close();
   }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;
   //--------------------------------------------------------
}


package vanya.and.fence;

import java.io.*;
import java.util.*;

public class Main{
   public static void main(String[] args) {
      MyScanner sc = new MyScanner();
      out = new PrintWriter(new BufferedOutputStream(System.out));

      // Solution
      int n = sc.nextInt(),h = sc.nextInt();
      List<Integer> a = new ArrayList<Integer>();

      for (int i = 0; i<n ; i++) {
    	  a.add(sc.nextInt());
      }

      long count = a.stream().filter(num -> num>h).count();
      out.println(count + a.size());
      // Solution end
      out.close();
   }

   //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;

   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
   //--------------------------------------------------------
}


package dis;

import java.util.Scanner;

public class Dis {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

  int x=input.nextInt();
  int y=input.nextInt();
  int c=0;
  int arr[]=new int [10000];
  for(int i=0;i<x;i++)
  {
      arr[i]=input.nextInt();
  }
   for(int i=0;i<x;i++)
  {
     if(arr[i]>y)
     {
         c+=2;
     }
     else
     {
         c++;
     }
  }
        System.out.println(c);

    }

}


import java.util.Scanner;

public class Dis {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

  int x=input.nextInt();
  int y=input.nextInt();
  int c=0;
  int arr[]=new int [10000];
  for(int i=0;i<x;i++)
  {
      arr[i]=input.nextInt();
  }
   for(int i=0;i<x;i++)
  {
     if(arr[i]>y)
     {
         c+=2;
     }
     else
     {
         c++;
     }
  }
        System.out.println(c);

    }

}


package dis;

import java.util.Scanner;

public class Dis {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);

  int x=input.nextInt();
  int y=input.nextInt();
  int c=0;
  int arr[]=new int [10000];
  for(int i=0;i<x;i++)
  {
      arr[i]=input.nextInt();
  }
   for(int i=0;i<x;i++)
  {
     if(arr[i]>y)
     {
         c+=2;
     }
     else
     {
         c++;
     }
  }
        System.out.print(c);

return 0;

    }

}


import java.util.Scanner;
import java.util.*;

public class JavaApplication5 {

    public static void main(String[] args) {
      Scanner in = new Scanner(System.in);
        short n ,h,sum=0;
        n=in.nextShort();
        h=in.nextShort();
        short arr[]= new short[n];
        for(short i=0;i<n;i++)
        {
            arr[i]=in.nextShort();
            if(arr[i]<=h)
                sum+=1;
            else
                sum+=2;
        }
        System.out.println(sum);
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class VanyaAndFence {

	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next()
		{
			while(st == null || !st.hasMoreElements())
			{
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}
	}

	public static void main(String[] args)
	{

		FastReader fr = new FastReader();

        int n, h;       //n = number of friends, h = height of fence
        int tempWidth, width = 0;
        n = fr.nextInt();
        h = fr.nextInt();

        int a[] = new int[n

        for (int i = 0; i < n; i++) {
            a[i] = fr.nextInt();
            if (a[i] <= h) {
                tempWidth = 1;
            } else {
                tempWidth = 2;
            }
            width += tempWidth;
        }

        System.out.println(width);
    }

}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class VanyaAndFence1 {

		    static class Reader
		    {
		        final private int BUFFER_SIZE = 1 << 16;
		        private DataInputStream din;
		        private byte[] buffer;
		        private int bufferPointer, bytesRead;

		        public Reader()
		        {
		            din = new DataInputStream(System.in);
		            buffer = new byte[BUFFER_SIZE];
		            bufferPointer = bytesRead = 0;
		        }

		        public Reader(String file_name) throws IOException
		        {
		            din = new DataInputStream(new FileInputStream(file_name));
		            buffer = new byte[BUFFER_SIZE];
		            bufferPointer = bytesRead = 0;
		        }

		        public String readLine() throws IOException
		        {
		            byte[] buf = new byte[64]; // line length
		            int cnt = 0, c;
		            while ((c = read()) != -1)
		            {
		                if (c == '\n')
		                    break;
		                buf[cnt++] = (byte) c;
		            }
		            return new String(buf, 0, cnt);
		        }

		        public int nextInt() throws IOException
		        {
		            int ret = 0;
		            byte c = read();
		            while (c <= ' ')
		                c = read();
		            boolean neg = (c == '-');
		            if (neg)
		                c = read();
		            do
		            {
		                ret = ret * 10 + c - '0';
		            }  while ((c = read()) >= '0' && c <= '9');

		            if (neg)
		                return -ret;
		            return ret;
		        }

		        public long nextLong() throws IOException
		        {
		            long ret = 0;
		            byte c = read();
		            while (c <= ' ')
		                c = read();
		            boolean neg = (c == '-');
		            if (neg)
		                c = read();
		            do {
		                ret = ret * 10 + c - '0';
		            }
		            while ((c = read()) >= '0' && c <= '9');
		            if (neg)
		                return -ret;
		            return ret;
		        }

		        public double nextDouble() throws IOException
		        {
		            double ret = 0, div = 1;
		            byte c = read();
		            while (c <= ' ')
		                c = read();
		            boolean neg = (c == '-');
		            if (neg)
		                c = read();

		            do {
		                ret = ret * 10 + c - '0';
		            }
		            while ((c = read()) >= '0' && c <= '9');

		            if (c == '.')
		            {
		                while ((c = read()) >= '0' && c <= '9')
		                {
		                    ret += (c - '0') / (div *= 10);
		                }
		            }

		            if (neg)
		                return -ret;
		            return ret;
		        }

		        private void fillBuffer() throws IOException
		        {
		            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
		            if (bytesRead == -1)
		                buffer[0] = -1;
		        }

		        private byte read() throws IOException
		        {
		            if (bufferPointer == bytesRead)
		                fillBuffer();
		            return buffer[bufferPointer++];
		        }

		        public void close() throws IOException
		        {
		            if (din == null)
		                return;
		            din.close();
		        }
		    }

		    public static void main(String[] args) throws IOException
		    {
		        Reader s=new Reader();
		        int n, h;       //n = number of friends, h = height of fence
		        int tempWidth, width = 0;

		       // System.out.println("Enter number of friends : ");
		        n = s.nextInt();
		       // System.out.println("Enter the height of the fence : ");
		        h = s.nextInt();

		        int a[] = new int[n];       //array of height of the girls

		        for (int i = 0; i < n; i++) {
		            a[i] = s.nextInt();
		            if (a[i] <= h) {
		                //System.out.println("Height is less than fence");
		                tempWidth = 1;
		            } else {
		                //System.out.println("Height is more");
		                tempWidth = 2;
		            }
		            width += tempWidth;
		        }

		        System.out.println(width);
		    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class VanyaAndFence {

	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next()
		{
			while(st == null || !st.hasMoreElements())
			{
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		FastReader fr = new FastReader();

        int n, h;       //n = number of friends, h = height of fence
        int tempWidth, width = 0;

       // System.out.println("Enter number of friends : ");
        n = fr.nextInt();
       // System.out.println("Enter the height of the fence : ");
        h = fr.nextInt();

        int a[] = new int[n];       //array of height of the girls

        for (int i = 0; i < n; i++) {
            a[i] = fr.nextInt();
            if (a[i] <= h) {
                //System.out.println("Height is less than fence");
                tempWidth = 1;
            } else {
                //System.out.println("Height is more");
                tempWidth = 2;
            }
            width += tempWidth;
        }

        System.out.println(width);
        }

}


#include<bits/stdc++.h>
using namespace std;
string s,z,dd;
int n,cnt,ind;
int main(){

    cin>>n;

    for(auto i=0;i<n;i++){
        string x;
        cin >> x;
        s += x+"<3" ;
    }

    cin>>z;

    for(auto i=0;i<z.size();i++){
        if(s[ind]==z[i]){
            dd+=s[ind];
            //cout<<s[ind]<<" "<<z[i]<<endl;
            cnt++,ind++;
        }
    }
    //cout<<s<<endl;
    //cout<<dd<<endl;
    if(cnt == s.size())
        cout<<"yes"<<endl;
    else
        cout<<"no"<<endl;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);

	int n;
	string temp , x , s , temp1;

	cin>>n;

	for(int i=0 ; i<n ; i++){
		cin>>x;
		temp+=x;
	}

	cin>>s;

	for(int i=0 ; i<(int)s.size() ; i++){
		if(s[i] >= 'a' and s[i] <= 'z') temp1+=s[i];
	}

	if(temp == temp1 and s[(int)s.size() - 1] == '3' and s[(int)s.size() - 2] == '<') cout<<"yes";
	else cout<<"no";
}