# 题目描述

### 分析

//By Bibi
///                 .-~~~~~~~~~-._       _.-~~~~~~~~~-.
///             __.'              ~.   .~              .__
///           .'//                  \./                  \\.
///        .'//                     |                     \\.
///       .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\.
///     .'//.-"                 -.  |  .-'                 "-.\\.
///   .'//______.============-..   \ | /   ..-============.______\\.
/// .'______________________________\|/______________________________.
#include<bits/stdc++.h>
#define rep(i,a,b) for(long long i=a;i<=b;++i)
#define dep(i,a,b) for(long long i=a;i>=b;--i)
using namespace std;
const long long MAXN=20;
typedef long long ll;
ll sum=0,flag=1;
char c;
for(;c<'0'||c>'9';c=getchar())if(c=='-') flag=-1;
for(;c>='0'&&c<='9';c=getchar())sum=(sum<<1)+(sum<<3)+c-'0';
return sum*flag;
}
ll n;
ll a[MAXN];
ll ans1,ans2;
ll x,y;
ll gcd(ll a,ll b){
return b? gcd(b,a%b):a;
}
void init(){
}
void work1(){
rep(i,0,(1<<n)-1){
ll tot=0,true_num=8;
rep(j,0,n-1){
if(i&(1<<j)){
true_num*=a[j]/gcd(true_num,a[j]);
if(true_num>x-1) break;
tot++;
}
}
if(tot&1) ans1-=(x-1)/true_num;
else ans1+=(x-1)/true_num;
}
}
void work2(){
rep(i,0,(1<<n)-1){
ll tot=0,true_num=8;
rep(j,0,n-1){
if(i&(1<<j)){
true_num*=a[j]/gcd(true_num,a[j]);
if(true_num>y) break;
tot++;
}
}
if(tot&1) ans2-=(y)/true_num;
else ans2+=(y)/true_num;
}
}
int main(){
init();
work1();
work2();
printf("%lld\n",ans2-ans1);
return 0;
}