#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    string s,s1;
    int n,m;
    cin >> m;
    vector<string> v;
    for(int i=0;i<m;i++)
    {
        cin >> s;
     n=s.size();
    if(n<=10)v.push_back(s);
    else
    {
        s1.push_back(s[0]);
        while(n-2)
        {
           s1.push_back(((n-2)%10)+'0');
           n/=10;
        }
        s1.push_back(s[n-1]);
        v.push_back(s1);
        s1.clear();
    }
    }
    for(int i=0;i<v.size();i++)
    {
        cout << v[i]<< endl;
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    string s,s1;
    int n,m;
    cin >> m;
    vector<string> v;
    for(int i=0;i<n;i++)
    {
        cin >> s;
     n=s.size();
    if(n<=10)v.push_back(s);
    else
    {
        s1.push_back(s[0]);
        s1.push_back(n-2+'0');
        s1.push_back(s[n-1]);
        v.push_back(s1);
        s1.clear();
    }
    }
    for(int i=0;i<n;i++)
    {
        cout << v[i]<< endl;
    }
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int n,m;
    cin >> m;
    while(m)
    {
       string s;
    cin >> s;
     n=s.size();
    if(n<=10)cout << s;
    else
    {
        cout << s[0] << n << s[n-1];
    }
    m--;
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    string s,s1;
    int n,m;
    cin >> m;
    vector<string> v;
    for(int i=0;i<m;i++)
    {
        cin >> s;
     n=s.size();
    if(n<=10)v.push_back(s);
    else
    {
        s1.push_back(s[0]);
        s1.push_back(n-2);
        s1.push_back(s[n-1]);
        v.push_back(s1);
        s1.clear();
    }
    }
    for(int i=0;i<v.size();i++)
    {
        cout << v[i]<< endl;
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    string s,s1;
    int n,m;
    cin >> m;
    vector<string> v;
    for(int i=0;i<m;i++)
    {
        cin >> s;
     n=s.size();
    if(n<=10)v.push_back(s);
    else
    {
        s1.push_back(s[0]);
        s1.push_back((n-2)-'0');
        s1.push_back(s[n-1]);
        v.push_back(s1);
        s1.clear();
    }
    }
    for(int i=0;i<v.size();i++)
    {
        cout << v[i]<< endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
 int n;
 cin >> n;
  vector<string> v;
  for(int i=0;i<n;i++)
{
 string s;
cin >> s;
v.push_back(s);
}
for(int i=0;i<n;i++)
{
 if(v[i].size>10) cout <<v[i][0]<<s.size()<<v[i][v[i].size()-1]<< endl;
else
{
cout << v[i];
}
}
return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    string s,s1;
    int n,m;
    cin >> m;
    vector<string> v;
    for(int i=0;i<n;i++)
    {
        cin >> s;
     n=s.size();
    if(n<=10)cout << v.push_back(s);
    else
    {
        s1.push_back(s[0]);
        s1.push_back(n+'0');
        s1.push_back(s[n-1]);
        v.push_back(s1);
        s1.clear();
    }
    }
    for(int i=0;i<n;i++)
    {
        cout << v[i];
    }
    return 0;
}


// Example program
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{int s,n;
cin>>s;
char a[100];
while(s--){
     cin>>a;
   n=strlen(a);
    if(n<=10) cout<<a;
    else cout<<a[0]<<n-2<<a[n-1];}
    return 0;}


// Example program
#include<stdio.h>
#include<ctype.h>
int main()
    {int n,i,m;
    char s[6000];
    scanf("%d",&n);
    for(int q=0;q<w;q++)scanf("%s",&s)
    int w=strlen(s);
    if(w>10){printf("%c",s[0]);
    printf("%d",w-2);
    printf("%c",s[w-1]);
    }else printf("%s",x);
    return 0;}


/ Example program
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{int s,n;
cin>>s;
char a[100];
while(s--){
     cin>>a;
   n=strlen(a);
    if(n<10) cout<<a;
    else
    cout<<a[0]<<n-2<<a[n-1];}
    return 0;}


#include <bits/stdc++.h>
#include<string>
using namespace std;
int main()
{int w,a;
scanf("%d",&w);
char q[100];
while(w--){
    scanf("%s",&q);
    a=strlen(q);
    if(a<=10)printf("%s\n",q);
  else   printf("%c%d%c\n",q[0],a-2,q[a-1]);
    return 0;

}


#include <stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{int a;
char s[6000];
scanf("%d",&a);
for(int z=0;z<a;z++){
    scanf("%s",&s);
int q=strlen(s);
if(q>10){
printf("%c",s[0]);
printf("%d",q-2);
printf("%c\n",s[q-1]);}
else printf("%s\n",s);}
return 0;}


// Example program
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{int s,n;
cin>>s;
char a[100];
for(int q=0;q<s;q++){
     cin>>a;
   n=strlen(a);
    if(n<=10) cout<<a;
    else cout<<a[0]<<n-2<<a[n-1];}
    return 0;}


#include <stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{int a;
char s[6000];
scanf("%d",&a);
for(int z=0;z<a;z++){
int q=strlen(s);
if(q>10){
printf("%c",s[0]);
printf("%d",q-2);
printf("%c",s[q-1]);}
else printf("%s",s);}
return 0;}


#include <stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{int a;
char s[6000];
scanf("%d",&a);
for(int z=0;z<a;z++)
int q=strlen(s);
{if(q>10){
printf("%c",s[0]);
printf("%d",q-2);
printf("%c",s[q-1]);}
else printf("%s",s);}
return 0;}


// Example program
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{int s,n;
cin>>s;
char a[100];
for(int q=0;q<s;q++){
     cin>>a;
   n=strlen(a);
    if(n>10)
     cout<<a[0]<<n-2<<a[n-1];
     else cout<<a;}
    return 0;}


#include <stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{int a;
char s[6000];
scanf("%d",&a);
for(int z=0;z<a;z++){
    scanf("%s",s);
int q=strlen(s);
if(q>10){
printf("%c",s[0]);
printf("%d",q-2);
printf("%c",s[q-1]);}
else printf("%s",s);}
return 0;}


/ Example program
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{int s,n;
cin>>s;
char a[100];
while(s--){
     cin>>a;
   n=strlen(a);
    if(n<=10) cout<<a;
    else
    cout<<a[0]<<n-2<<a[n-1];}
    return 0;}


#include<stdio.h>
#include<ctype.h>
int main()
    {int n,i,m;
    char s[6000];
    scanf("%d",&n);
    for(int q=0;q<w;q++)scanf("%s",&s)
    int w=strlen(s);
    if(w>10){printf("%c",s[0]);
    printf("%d",w-2);
    printf("%c\n",s[w-1]);
    }else printf("%s",s);
    return 0;}


#include <iostream>
#include <string>
#include<string.h>
using namespace std;
int main(){
    int s;
    cin>>s;
 char a[s];
 while(s--){
cin>>a;
 int i=strlen(a);
if(i<=10)cout<<a;
else cout<<a[0]<<(i-2)<<a[i-1];
}
    return 0;}


#include <stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{int a;
char s[6000];
scanf("%d",&a);
int q=strlen(s);
for(int z=0;z<a;z++)
{if(q>10){
printf("%c",s[0]);
printf("%d",q-2);
printf("%c",s[q-1]);}
else printf("%s",s);}
return 0;}


// Example program
#include <stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{int a;
char s[6000];
scanf("%d",&a);
for(int z=0;z<a;z++){
    scanf("%s",&s);
int q=strlen(s);
if(q>10){
printf("%c",s[0]);
printf("%d",q-2);
printf("%c",s[q-1]);}
else printf("%s",s);}
return 0;}


#include <bits/stdc++.h>
using namespace std;
int main()
{int w,a;
scanf("%d",&w);
char q[100];
while(w--){
    scanf("%s",&q);
    a=strlen(q);
    if(a<=10)printf("%s",q);
    else printf("%s",q[0],a-2,q[a-1]);}
    return 0;

}


#include <stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{int a;
char s[6000];
scanf("%d",&a);
int q=strlen(s);
for(int z=0;z<a;z++)
{if(q>10)
printf("%c",s[0]);
printf("%d",q-2);
printf("%c",s[q-1]);}
else printf("%s",s);
return 0;}


// Example program
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{int n,i;
char a[100];
cin>>n;
for(int q=0;q<n;q++){
     scanf("%s",&a);

   i=strlen(a);
    if(i<=10) printf("%s\n",a);

     else
     printf("%c%d%c\n",a[0],i-2,a[i-1]);
    }
    return 0;}


#include <bits/stdc++.h>
#include<string>
using namespace std;
int main()
{int w,a;
scanf("%d",&w);
char q[100];
while(w--){
    scanf("%s",&q);
    a=strlen(q);
    if(a<=10)printf("%s\n",q);
  else   printf("%c%d%c\n",q[0],a-2,q[l-1]);}
    return 0;

}


#include <stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{int a;
char s[6000];
scanf("%d",&a);
for(int z=1;z<=a;z++){
    scanf("%s",&s);
int q=strlen(s);
if(q>10){
printf("%c",s[0]);
printf("%d",q-2);
printf("%c\n",s[q-1]);}
else printf("%s\n",s);}
return 0;}


#include <bits/stdc++.h>
#include<string>
using namespace std;
int main()
{int w,a;
scanf("%d",&w);
char q[100];
while(w--){
    scanf("%s",&q);
    a=strlen(q);
    if(a<=10)printf("%s\n",q);
  else   printf("%c%d%c\n",q[0],a-2,q[a-1]);}
    return 0;

}


// Example program
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{int s,n;
cin>>s;
char a[100];
while(s--){
     cin>>a;
   n=strlen(a);
    if(n>10)
     cout<<a[0]<<n-2<<a[n-1];
     else cout<<a;}
    return 0;}


#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{int s,n;
cin>>s;
char a[100];
while(s--){
     cin>>a;
   n=strlen(a);
    if(n>10)
     cout<<a[0]<<n-2<<a[n-1];
     else cout<<a;}
    return 0;}


// Example program
#include<stdio.h>
#include<ctype.h>
int main()
    {int n,i,m;
    char s[1000];
    scanf("%d",&n);
    for(int q=0;q<w;q++)scanf("%s",&s)
    int w=strlen(s);
    if(w>10){printf("%c",s[0]);
    printf("%d",w-2);
    printf("%c",s[w-1]);
    }else printf("%s",x);
    return 0;}


#include<stdio.h>
#include<ctype.h>
int main()
    {int n,i,m;
    char s[6000];
    scanf("%d",&n);
    for(int q=0;q<w;q++)scanf("%s",&s)
    int w=strlen(s);
    if(w>10){printf("%c",s[0]);
    printf("%d",w-2);
    printf("%c",s[w-1]);
    }else printf("%s",s);
    return 0;}


#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10)
			{
				cout<<s1<<endl;
			}
			else(s1.length()>10||s1.length()==10)
		{

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include <iostream>

using namespace std;

int main()
{
    int n;
    string s;
    cin >> n;
    while (n--)
    {
        cin >> s;
        if (s.length() > 10)
        {
            cout << s[0] << s.length() - 2 << s[s.length() - 1] << endl;
        }
        else
        {
            cout << s << endl;
        }
    }
    return 0;
}


#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10)
			{
				cout<<s1<<endl;
			}
			else(s1.length()>10||s1.length()==10);
		{

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10)
			{
				cout<<s1;
			}
			else
			(sizeof(s1)>10||sizeof(s1)==10);{

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(sizeof(s1)<10||sizeof(s1)==10)
			{
				cout<<s1;
			}
			if(sizeof(s1)>10){

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10)
			{
				cout<<s1<<endl;
			}
			if(s1.length()>10||s1.length()==10)
		{

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10)
			{
				cout<<s1;
			}
			if(sizeof(s1)>10||sizeof(s1)==10){

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10)
			{
				cout<<s1<<endl;
			}
			else
		{

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10)
			{
				cout<<s1;
			}
			else(sizeof(s1)>10||sizeof(s1)==10);{

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10||s1.length()==10)
			{
				cout<<s1;
			}
			else(sizeof(s1)>10);{

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10||s1.length()==10)
			{
				cout<<s1;
			}
			if(sizeof(s1)>10){

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
  string s1;
  	for(int i=1;i<=n;i++){

  cin>>s1;
   	 	if(s1.length()<10)
			{
				cout<<s1;
			}
			else
		{

	cout<<s1[0]<<(s1.length()-2)<<s1[s1.length()-1]<<endl;

                 }

}
return 0;
    }


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++){
cin >>m[i]
if (m[i].size()>=10){
for(int i=1;i<m[i-1];i++)
v++;
cout<<m[0]<<v<<m[i]}
else {cout<<m[i]} ;
}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++){
cin >>m[i];
if(m[i].size()<=10){
for (int i=0 ;i<n;i++)
for(int i=1;i<m[n];i++){
v++;
cout<<m[0]<<v<<m[i];}}
else {cout<<m[i];}}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()>=10){
cout<<m[i][0]<<m[i].size()-2<<m[i][m[i] .size()-1]<<endl;}
else
 cout<<m[i]<<endl;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()>=10){
for(int i=1;i<m[i].size();i++){
v++;}
cout<<m[0]<<v<<m[n-1]<<endl;}
else
 cout<<m[i]<<endl;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()>=10){
for(int s=1;s<m[i].size();s++){
v++;}
cout<<m[0]<<v<<m[i]<<endl;}
else
 cout<<m[i]<<endl;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()>=10){
cout<<m[i][0]<<m[i].size()-2<<m[i][m.size()-1]<<endl;}
else
 cout<<m[i]<<endl;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++){
cin >>m[i];
if (m[i].size()>=10){
for(int i=1;i<m[n];i++)
v++;
cout<<m[0]<<v<<m[i]}
else {cout<<m[i]} ;
}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++){
cin >>m[i];
if (m[i].size()>=10){
for(int i=1;i<m[i-1];i++)
v++;
cout<<m[0]<<v<<m[i]}
else {cout<<m[i]} ;
}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()<=10){
for(int i=1;i<m.size();i++){
v++;}
cout<<m[0]<<v<<m[n-1];}
else
 cout<<m[i];}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++){
cin >>m[i];
for (int i=0 ;i<n;i++)
if (m[i].size()>=10){
for(int i=1;i<m[n];i++){
v++;
cout<<m[0]<<v<<m[i];}}
else {cout<<m;}}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()<=10){
for(int i=1;i<m.size();i++){
v++;}
cout<<m[0]<<v<<m[n-1];}
else
 cout<<m[i];
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()>=10){
for(int s=1;s<m[i].size();s++){
v++;}
cout<<m[i[0]]<<v<<m[i]<<endl;}
else
 cout<<m[i]<<endl;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()<=10){
for(int i=1;i<m[i].size();i++){
v++;}
cout<<m[0]<<v<<m[n-1];}
else
 cout<<m[i];
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++){
cin >>m[i];
if(m[i].size()<=10){
for (int i=0 ;i<n;i++)
for(int i=1;i<m[n];i++){
v++;
cout<<m[0]<<v<<m[i];}}
else {cout<<m[i];}}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(i=0;i<n;i++){
cin >>m[i]
if (m[i].size()>=10){
for(i=1;i<m[i-1];i++)
v++;
cout<<m[0]<<v<<m[i]}
else cout<<m[i] ;
}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++){
cin >>m[i];
for (int i=0 ;i<n;i++)
if (m[i].size()>=10){
for(int i=1;i<m[i-1];i++){
v++;
cout<<m[0]<<v<<m[i];}}
else {cout<<m;}}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()<=10){
for(int i=1;i<m.size();i++){
v++;}
cout<<m[0]<<v<<m[n-1];}
else
 cout<<m[i];}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()>=10){
for(int s=1;s<m[i].size();s++){
v++;}
cout<<m[i].size(1)<<v<<m[i].size()<<endl;}
else
 cout<<m[i]<<endl;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()<=10){
for(int i=1;i<m[n];i++){
v++;}
cout<<m[0]<<v<<m[n-1];}
else
 cout<<m[i];}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()<=10){
for(int i=1;i<m[i].size();i++){
v++;}
cout<<m[0]<<v<<m[n-1]<<endl;}
else
 cout<<m[i]<<endl;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++)
cin >>m[i];
for(int i=0;i<n;i++){
if(m[i].size()>10){
cout<<m[i][0]<<m[i].size()-2<<m[i][m[i] .size()-1]<<endl;}
else
 cout<<m[i]<<endl;
}
return 0;
}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++){
cin >>m[i];}
for (int i=0 ;i<m.size();i++)
if (m[i].size()>=10){
for(int i=1;i<m[i-1];i++){
v++;
cout<<m[0]<<v<<m[i];}}
else {cout<<m;}
return 0;}


#include <bits/stdc++.h>
using namespace std ;
int main() {
int n,v=0;
string m[100];
cin>>n;
for(int i=0;i<n;i++){
cin >>m[i];
if (m[i].size()>=10){
for(int i=1;i<m[n-1];i++)
v++;
cout<<m[0]<<v<<m[i]}
else {cout<<m[i]} ;
}
return 0;}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,i;
cin>>n;
char arr[100];
while(n>0){
for(i=0;i<100;i++){
cin>>arr[i];}
   int a=strlen(arr);
   cout<<arr[0]<<(a-2)<<arr[a-1];
n--;

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,i;
cin>>n;
string arr;
while(n>0){
cin>>arr;

   int a=arr.size();
if(a>10)
   cout<<arr[0]<<(a-2)<<arr[a-1];
else
cout<<arr;
cout<<endl;
n--;

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,i;
cin>>n;
string arr;
while(n>0){
cin>>arr;

   int a=arr.size;
if(a>10)
   cout<<arr[0]<<(a-2)<<arr[a-1];
else
cout<<arr;
n--;

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,i;
for(i=0;i<100;i++){
char arr[i];}
while(n>0){
   cin>>arr[100];
   int a=strlen(arr);
   cout<<arr[0]<<(a-2)<<arr[a-1];
n--;

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int n;
char arr[];
while(n>0){
   cin>>arr[];
   int a=strlen(arr[]);
   cout<<arr[0]<<(a-2)<<arr[a-1];
n--;

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,i;
while(n>0){
for(i=0;i<100;i++){
char arr[i];}
   int a=strlen(arr);
   cout<<arr[0]<<(a-2)<<arr[a-1];
n--;

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,i;
cin>>n;
string arr;
while(n>0){
cin>>arr;

   int a=arr.size();
if(a>10)
   cout<<arr[0]<<(a-2)<<arr[a-1];
else
cout<<arr<<endl;
n--;

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int n;
while(n>0){
   cin>>arr[];
   int a=strlen(arr[]);
   cout<<arr[0]<<(a-2)<<arr[a-1];
n--;

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int n,i;
while(n>0){
for(i=0;i<100;i++){
char arr[i];}
   int a=strlen(arr[100]);
   cout<<arr[0]<<(a-2)<<arr[a-1];
n--;

}
}


include<iostream>
using namespace std;
int main()
{int n;
while(n>0){
   cin>>arr[];
   int a=strlen(arr[]);
   cout<<arr[0]<<(a-2)<<arr[a-1];
n--;

}

}


#include<iostream>
#include<cstdio>
using namespace std;
const int p=100005,mod=1000000007;
bool heshu[p]; int cnt[p],ans,tong[p],n,T,k,r,miu[p],que[p],m;
inline int pow(int a,int b){
	int t=1,y=a;
	while (b){
		if (b&1) t=(long long)t*y%mod;
		y=(long long)y*y%mod;
		b>>=1;
	}
	return t;
}
inline int read()//读入一个正数
{
	int a=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	a=a*10+ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9')
	{
		a=a*10+ch-'0';
		ch=getchar();
	}
	return a;
}
inline void write(int a)
{
	if(a>=10)write(a/10);
	putchar('0'+a%10);
}
int main(){
	for(int i=2;i<p;i++){
	    if(!heshu[i]){que[++r]=i; miu[i]=-1;}
        for(int j=1;j<=r&&i<=(p-1)/que[j];j++){
            heshu[k=i*que[j]]=1;
            if (i%que[j]==0){miu[k]=0; break;}
            miu[k]=miu[i]*miu[que[j]];
        }
    }miu[1]=1;
    n=read();
    for(int i=1;i<=n;i++){ tong[read()]++;}
    for(int i=1;i<p;i++){
    	for(int j=i;j<p;j+=i)cnt[i]+=tong[j];
    	cnt[i]=pow(2,cnt[i])-1; if(cnt[i]<0)cnt[i]=mod-1;
    	ans=(ans+(long long)cnt[i]*miu[i])%mod;
	}
	cout<<(ans%mod+mod)%mod<<endl;
}


/*
    @Author: wchhlbt
    @Date:   2017/4/28
*/
#include <bits/stdc++.h>

#define Fori(x) for(int i=0;i<x;i++)
#define Forj(x) for(int j=0;j<x;j++)
#define maxn 100007
#define inf 0x3f3f3f3f
#define ONES(x) __builtin_popcount(x)
using namespace std;

typedef long long ll ;
const double eps =1e-8;
const int mod = 1000000007;
typedef pair<int, int> P;
const double PI = acos(-1.0);
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};

int h[maxn];
ll f[maxn];
const int o = 100000;

ll quickpow(ll m,ll n,ll k)     // return m^n % k
{
    ll b = 1;
    m = m%k;
    while (n > 0)
    {
          if (n & 1)
             b = (b*m)%k;
          n = n >> 1 ;
          m = (m*m)%k;
    }
    return b;
}

int main()
{
    //freopen("test.txt","r",stdin);
    int n,m;
    scanf("%d",&n);
    while(n--){
        scanf("%d",&m);
        for(int i = 1; i*i<=m; i++){
            if(m%i==0){
                h[i]++;
                if(i*i!=m)
                    h[m/i]++;
            }
        }
    }
    for(int i = 1; i<=o; i++)
        f[i] = quickpow(2,h[i],mod) - 1;
    for(int i = o; i; i--){
        for(int j = i+i; j<=o; j+=i){
            f[i] = ( f[i] - f[j] + mod )%mod;
        }
    }
    cout << f[1] << endl;
    return 0;
}

/*

unsigned   int   0～4294967295
int   2147483648～2147483647
unsigned long 0～4294967295
long   2147483648～2147483647
long long的最大值：9223372036854775807
long long的最小值：-9223372036854775808
unsigned long long的最大值：18446744073709551615

__int64的最大值：9223372036854775807
__int64的最小值：-9223372036854775808
unsigned __int64的最大值：18446744073709551615

*/


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <assert.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;

#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <bitset>
LL quick_pow(LL a, LL b, LL MOD) {
    LL ans = 1;
    LL base = a;
    while (b) {
        if (b & 1) {
            ans = ans * base % MOD;
        }
        b >>= 1;
        base = base * base % MOD;
    }
    return (ans - 1 + MOD) % MOD;
}
const int maxn = 100000 + 20;
int cnt[maxn];
int prime[maxn];//这个记得用int，他保存的是质数，可以不用开maxn那么大
bool check[maxn];
int total;
int mu[maxn];
void initprime() {
    mu[1] = 1; //固定的
    for (int i = 2; i <= maxn - 20; i++) {
        if (!check[i]) { //是质数了
            prime[++total] = i; //只能这样记录，因为后面要用
            mu[i] = -1; //质因数分解个数为奇数
        }
        for (int j = 1; j <= total; j++) { //质数或者合数都进行的
            if (i * prime[j] > maxn - 20) break;
            check[i * prime[j]] = 1;
            if (i % prime[j] == 0) {
                mu[prime[j] * i] = 0;
                break;
            }
            mu[prime[j] * i] = -mu[i];
            //关键，使得它只被最小的质数筛去。例如i等于6的时候。
            //当时的质数只有2,3,5。6和2结合筛去了12，就break了
            //18留下等9的时候，9*2=18筛去
        }
    }
}

void calc(int val) {
    int en = (int)sqrt(val * 1.0);
    bool flag = false;
    for (int i = 2; i <= en; ++i) {
        if (val % i == 0) {
            flag = true;
            cnt[i]++;
            if (val / i != i)
                cnt[val / i]++;
        }
    }
    cnt[val]++;
}
const int MOD = 1e9 + 7;
void work() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int x;
        cin >> x;
        calc(x);
    }
    LL ans = quick_pow(2, n, MOD);
//    cout << cnt[5] << endl;
    for (int i = 2; i <= maxn - 20; ++i) {
        ans = (ans + MOD + mu[i] * quick_pow(2, cnt[i], MOD)) % MOD;
    }
    cout << ans << endl;
}

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    initprime();
    work();
    return 0;
}


#include <cstdio>

const int MAXN = 100005, MOD = 1000000007;
int N, a[MAXN], pow2[MAXN] = {1}, cnt[MAXN] = {0};

struct NumberTheory {
	bool isPrime[MAXN];
	int primeCount, primeList[MAXN], mu[MAXN];
	NumberTheory() {
		isPrime[1] = false;
		mu[1] = 1;
		for (int i = 2; i < MAXN; ++i) isPrime[i] = true;
		primeCount = 0;
		sift();
	}
	void sift() {
		for (int i = 2; i < MAXN; ++i) {
			if (isPrime[i])
				primeList[primeCount++] = i, mu[i] = -1;
			for (int j = 0; j < primeCount; ++j) {
				if (i * primeList[j] >= MAXN) break;
				isPrime[i * primeList[j]] = false;
				if (i % primeList[j] == 0) {
					mu[i * primeList[j]] = 0;
					break;
				}
				else
					mu[i * primeList[j]] = -mu[i];
			}
		}
	}
}numberTheory;

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i)
		scanf("%d", a + i);
	for (int i = 1; i <= N; ++i)
		pow2[i] = (pow2[i - 1] << 1) % MOD;
	for (int i = 1; i <= N; ++i)
		for (int j = 1; j * j <= a[i]; ++j)
			if (a[i] % j == 0) {
				++cnt[j];
				if (j * j != a[i])
					++cnt[a[i] / j];
			}
	long long ans = 0;
	for (int i = 1; i < MAXN; ++i)
		ans += ((pow2[cnt[i]] - 1) * numberTheory.mu[i] + MOD) % MOD;
	printf("%d\n", (int)(ans % MOD));
	return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<queue>
#include<set>
#include <iostream>
#include<stack>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#define N 1000000
#define sn scanf
#define pf printf
#define pb push_back
#define mp make_pair

const double PI=2.0*acos(0);

typedef long long int ll;
using namespace std;
struct T{
int a;
};
struct vec{
double x,y;
 vec(double xx=0,double yy=0)
 {
     x=xx;y=yy;
 }
};
vec make_vac(vec p,vec q)
{
    return vec(q.x-p.x,q.y-p.y);
}
double dotproduct(vec p,vec q)
{
    return p.x*q.x+p.y*q.y;
}
double crossproduct(vec p,vec q)
{
    return p.x*q.y-q.x*p.y;
}
double vec_value(vec p)
{
    return sqrt(p.x*p.x + p.y*p.y);
}
vec unit_vec(vec p)
{
    double va=vec_value(p);
    return vec(p.x/va,p.y/va);
}
double dis(double px,double py,double qx,double qy)
{
    px=fabs(px-qx);
    py=fabs(py-qy);
    return sqrt(px*px+py*py);
}
ll bigmod(ll a,ll b,ll mod)
{
    if(a==0)
        return 0;
    if(b==0)return 1;
    if(b%2==0)
    {
        ll hh=bigmod(a,b/2,mod);
        return (hh*hh)%mod;
    }
    else
    {
       return (a*bigmod(a,b-1,mod))%mod;
    }
}
int vis[100005],cnt[100005];
vector<int>pr[100005];
int main()
{
    ll i,j,k,l,t,cs=1,r=1,s,m,n,a,b,c,d,e,f,g,h,u,v;

    //freopen(".txt","r",stdin);
    //freopen(".txt","w",stdout);
    memset(vis,0,sizeof(vis));
    for(i=2;i<=100000;i++)
    {
        if(vis[i]==0)
        for(j=i;j<=100000;j+=i)
        {
            vis[j]++;
            pr[j].pb(i);
        }
    }
    sn("%I64d",&n);
    ll ans=0,mod=1000000007;
    ans=bigmod(2,n,mod)-1+mod;
    ans= ans%mod;
    memset(cnt,0,sizeof(cnt));
    for(i=0;i<n;i++)
    {
        sn("%I64d",&u);
        for(j=1;j< 1<<vis[u];j++)
        {
            v=1;
            for(k=0;k<vis[u];k++)
            {
                if((j&(1<<k))!=0)
                {
                    v=v*pr[u][k];
                }
            }
            cnt[v]++;
        }
    }
    for(i=2;i<=100000;i++)
    {
        if(vis[i]%2==0)
        {
            ans=ans+(bigmod(2,cnt[i],mod)-1)+mod;
        }
        else
        {
            ans=ans-(bigmod(2,cnt[i],mod)-1)+mod;
        }
        ans=ans%mod;
    }
    pf("%I64d\n",ans);
    return 0;

}

/*
#include <bits/stdc++.h>
  #define _ ios_base::sync_with_stdio(0);cin.tie(0);
*/


#include <bits/stdc++.h>

using namespace std;

const int MOD = 1000 * 1000 * 1000 + 7;

inline void add(int &a, int b) {
	a += b;
	if (a >= MOD) {
		a -= MOD;
	}
}

inline int mul(int a, int b) {
	return (long long)a * b % MOD;
}

inline int power(int x, int n) {
	int res = 1;
	while (n) {
		if (n & 1) {
			res = mul(res, x);
		}
		x = mul(x, x);
		n >>= 1;
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	const int N = 100 * 1000;

	int n;
	cin >> n;

	vector <int> f(N + 10);

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

	vector <bool> sieve(N + 10);
	sieve[0] = sieve[1] = true;
	for (int i = 2; i * i <= N; i++) {
		if (!sieve[i]) {
			for (int j = i * i; j <= N; j += i) {
				sieve[j] = true;
			}
		}
	}

	vector <int> mu(N + 10);

	for (int i = 1; i <= N; i++) {
		mu[i] = 1;
	}

	for (int i = 2; i * i <= N; i++) {
		if (!sieve[i]) {
			int x = i * i;
			for (int y = x; y <= N; y += x) {
				mu[y] = 0;
			}
		}
	}

	for (int i = 2; i <= N; i++) {
		if (!sieve[i]) {
			for (int j = i; j <= N; j += i) {
				mu[j] = -mu[j];
			}
		}
	}

	int ans = power(2, n);
	add(ans, MOD - 1);

	for (int i = 2; i <= N; i++) {
		if (mu[i] != 0) {
			int c = 0;
			for (int j = i; j <= N; j += i) {
				c += f[j];
			}
			if (mu[i] == -1) {
                int v = power(2, c);
                add(v, MOD - 1);
				add(ans, MOD - v);
			} else {
			    int v = power(2, c);
			    add(v, MOD - 1);
				add(ans, v);
			}
		}
	}
	cout << ans << "\n";
}


//Author: Lixiang
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
using namespace std;
const int MOD=1000000007;
const int maxn=100001;
long long mod(long long a){
	return a<MOD?a:a-MOD;
}
int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}
struct F{
	int Q[maxn];
	long long st[maxn],ans;
	int P[maxn],pcnt;
	int a[maxn],N;
	char isprime[maxn+1];
	void getprime(){
		P[++pcnt]=2;
		for(int i=3;i<maxn;i+=2){
			isprime[i+1]=1;
			if(isprime[i])continue;
			P[++pcnt]=i;
			if(i>400)continue;
			for(int j=i*i;j<maxn;j+=i)
				isprime[j]=1;
		}
	}
	void init(){
		getprime();
		scanf("%d",&N);
		st[0]=1;
		for(int i=1;i<=N;i++){
			scanf("%d",a+i);
			st[i]=mod(st[i-1]+st[i-1]);
		}
	}
	/*void dfs(int id,int g){
		if(g==1){
			ans=mod(ans+st[N-id]);
			return ;
		}
		for(int i=id+1;i<=N;i++)
			dfs(i,gcd(g,a[i]));
	}*/
	void work(){
		ans=st[N]-1;
		for(int i=1;i<=N;i++){
			int lim=sqrt(a[i]);
			for(int j=1;j<=lim;j++)
				if(a[i]%j==0){
					Q[j]++;
					Q[a[i]/j]++;
				}
			if(lim*lim==a[i])Q[lim]--;
			//dfs(i,a[i]);
		}
		for(int i=2;i<=100000;i++){
			if(isprime[i]==0){
				ans=mod(ans-st[Q[i]]+1+MOD);
				continue;
			}
			int ii=i,cnt=0,iii=1;
			while(ii>1){
				while(iii<=pcnt&&ii>=P[iii]&&ii%P[iii]!=0)iii++;
				if(ii%P[iii]!=0)break;
				ii/=P[iii];
				if(ii%P[iii]==0)break;
				cnt++;
			}
			if(ii!=1)continue;
			ans=(ans+(cnt%2==0?1:-1)*(st[Q[i]]-1))%MOD;
		}
		printf("%I64d\n",ans);
	}
}sol;
int main(){
	sol.init();
	sol.work();
	return 0;
}


//Author: Lixiang
#include<stdio.h>
const int MOD=1000000007;
const int maxn=100001;
long long mod(long long a){
	return a<MOD?a:a-MOD;
}
int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}
struct F{
	long long st[maxn],ans;
	int a[maxn],N;

	void init(){
		scanf("%d",&N);
		st[0]=1;
		for(int i=1;i<=N;i++){
			scanf("%d",a+i);
			st[i]=mod(st[i-1]+st[i-1]);
		}
	}
	void dfs(int id,int g){
		if(g==1){
			ans=mod(ans+st[N-id]);
			return ;
		}
		for(int i=id+1;i<=N;i++)
			dfs(i,gcd(g,a[i]));
	}
	void work(){
		for(int i=1;i<=N;i++)
			dfs(i,a[i]);
		printf("%I64d\n",ans);
	}
}sol;
int main(){
	sol.init();
	sol.work();
	return 0;
}


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

const int K = 1e9 + 7;
const int MAXN = 1e5 + 10;
int n, m = 100000, h[MAXN] = {0}, f[MAXN];

int power(long long x, int k) {
	long long t = 1;
	for (; k; x = x * x % K, k >>= 1)
		if (k & 1)
			t = t * x % K;
	return t;
}

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	while (n--) {
		int x;
		cin >> x;
		for (int j = 1; j * j <= x; ++j)
			if (x % j == 0) {
				++ h[j];
				if (j * j != x)
					++ h[x / j];
			}
	}
	for (int i = 1; i <= m; ++i)
		f[i] = power(2, h[i]) - 1;
	for (int i = m; i; --i)
		for (int j = i + i; j <= m; j += i)
			f[i] = (f[i] - f[j] + K) % K;
	cout << f[1] << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<char> vc;
typedef pair<int, int> pi;
const int mod = 1e9 + 7;
const double EPS = 1e-9;
const int INF = 1 << 29;
#define mp make_pair
#define el putchar('\n')
#define sp putchar(' ')
#define Fill(a,val) memset(a,val,sizeof a)
#define all(a) a.begin(),a.end()
#ifndef ONLINE_JUDGE
#define tr(a, it) for (decltype(a.begin()) it = a.begin(); it != a.end(); ++it)
#else
#define tr(a, it) for (typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#endif
#define in(n) scanf("%d",&n)
#define inl(n) scanf("%I64d",&n)
#define out(n) printf("%d",n);
#define outl(n) printf("%I64d",n);

int const NN = 1e5 + 5;
int a[NN];
ll ans[NN];
int cnt[NN];
ll p2[NN];

void fct(int num){
	for (int i = 1; i*i <= num; ++i){
		if (num%i)continue;
		int f1 = i;
		int f2 = num / i;
		++cnt[f1];
		if (f1 != f2)++cnt[f2];
	}
}

int main(){
	p2[0] = 1;
	for (int i = 1; i < NN; ++i)
		p2[i] = (p2[i - 1] * 2ll) % mod;
	int n; in(n); int mx = 0;
	for (int i = 1; i <= n; ++i){
		in(a[i]);
		fct(a[i]); mx = max(mx, a[i]);
	}
	for (int i = mx; i > 1; --i){
		ll tot = cnt[i] * 1ll;
		tot = (p2[tot] - 1ll + 1ll * mod) % mod;
		for (ll j = 2; j*i <= mx; ++j){
			tot = (tot - ans[j*i] + mod) % mod;
		}
		ans[i] = tot;
	}
	ll answer = 0;
	for (int i = 2; i <= mx; ++i){
		answer = (answer + ans[i]) % mod;
	}
	answer = (p2[n] - answer - 1 + mod) % mod;
	outl(answer); el;
	return 0;
}


#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#define N 100002
using namespace std;
const int P = 1e9 + 7;
int a[N],n,g[N],f[N],M,bin[N];
int main()
{
	scanf("%d",&n);
	memset(g,0,sizeof(g));
	for (int i = 1;i <= n; ++i) scanf("%d ",&a[i]);
	M = 0;
	for (int i = 1;i <= n; ++i) M = max(M,a[i]);
	for (int i = 1;i <= n; ++i)
	{
		for (int j = 1;j * j <= a[i]; ++j)
			if (!(a[i] % j))
			{
				++g[j];
				if (j * j != a[i]) ++g[a[i] / j];
			}
	}
	bin[0] = 1;
	for (int i = 1;i <= max(n,M); ++i) bin[i] = (bin[i - 1] << 1) % P;
	for (int i = 1;i <= M; ++i) g[i] = bin[g[i]] - 1;
	//for (int i = 1;i <= M; ++i) cout<<g[i]<<endl;
	for (int i = M;i >= 1; --i)
	{
		f[i] = (g[i] + P) % P;
		for (int j = i + i;j <= M; j += i)
			f[i] = (f[i] + P - f[j]) % P;
	}
	cout<<f[1];
	return 0;
}


#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;
typedef long long ll;
int getint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar();	}
	while('0'<=ch&&ch<='9') { x=x*10+ch-'0'; ch=getchar();	}
	return f*x;
}
#define N 112345
ll bin[N];
int a[N];
int b[N];
int pri[N],tot,vis[N];
int mu[N];
void init(){
	mu[1]=1;
	for(int i=2;i<N;i++) {
		if(!vis[i]) pri[++tot]=i,mu[i]=-1;
		for(int j=1;j<=tot&&pri[j]*i<N;j++) {
			vis[pri[i]*i]=1;
			if(i%pri[j]==0) { mu[i*pri[j]]=0;break;}
			mu[i*pri[j]]=-mu[i];
		}
	}
}
#define mod 1000000007
ll md(ll x){
	if(x>=mod) return x-mod;
	else if(x<0) return x+mod;
	return x;
}
int main(){
	init();
	int n=getint();
	for(int i=1;i<=n;i++) a[getint()]++;
	for(int i=1;i<N;i++) for(int j=i;j<N;j+=i) b[i]+=a[j];
	bin[0]=1; for(int i=1;i<N;i++) bin[i]=md(bin[i-1]<<1);
	ll ans=0;
	for(int i=1;i<N;i++) {
//		if(b[i]) cout<<i<<" "<<b[i]<<" "<<bin[b[i]]<<" "<<mu[i]<<endl;
		ans+=mu[i]*(bin[b[i]]-1);
		ans=md(ans);
	}
	cout<<ans<<endl;
}


#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;
typedef long long ll;
int getint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar();	}
	while('0'<=ch&&ch<='9') { x=x*10+ch-'0'; ch=getchar();	}
	return f*x;
}
#define N 112345
ll bin[N];
int a[N];
int b[N];
int pri[N],tot,vis[N];
int mu[N];
void init(){
	mu[1]=1;
	for(int i=2;i<N ;i++) {
		if(!vis[i]) pri[++tot]=i,mu[i]=-1;
		else {
			for(int j=1;j<=tot&&pri[j]*i<N;j++) {
				vis[pri[i]*i]=1;
				if(i%pri[j]==0) { mu[i*pri[j]]=0;break;}
				mu[i*pri[j]]=-mu[i];
			}
		}
	}
}
#define mod 1000000007
ll md(ll x){
	if(x>=mod) return x-mod;
	else if(x<0) return x+mod;
	return x;
}
int main(){
	init();
	int n=getint();
	for(int i=1;i<=n;i++) a[getint()]++;
	for(int i=1;i<N;i++) for(int j=i;j<N;j+=i) b[i]+=a[j];
	bin[0]=1; for(int i=1;i<N;i++) bin[i]=md(bin[i-1]<<1);
	ll ans=0;
	for(int i=1;i<N;i++) {
		ans+=mu[i]*(bin[b[i]]-1);
		ans=md(ans);
	}
	cout<<ans<<endl;
}


#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;
typedef long long ll;
int getint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar();	}
	while('0'<=ch&&ch<='9') { x=x*10+ch-'0'; ch=getchar();	}
	return f*x;
}
#define N 112345
ll bin[N];
int a[N];
int b[N];
int pri[N],tot,vis[N];
int mu[N];
void init(){
	mu[1]=1;
	for(int i=2;i<N;i++) {
		if(!vis[i]) pri[++tot]=i,mu[i]=-1;
		for(int j=1;j<=tot&&pri[j]*i<N;j++) {
			vis[pri[j]*i]=1;
			if(i%pri[j]==0) { mu[i*pri[j]]=0;break;}
			mu[i*pri[j]]=-mu[i];
		}
	}
}
#define mod 1000000007
ll md(ll x){
	if(x>=mod) return x-mod;
	else if(x<0) return x+mod;
	return x;
}
int main(){
	init();
	int n=getint();
	for(int i=1;i<=n;i++) a[getint()]++;
	for(int i=1;i<N;i++) for(int j=i;j<N;j+=i) b[i]+=a[j];
	bin[0]=1; for(int i=1;i<N;i++) bin[i]=md(bin[i-1]<<1);
	ll ans=0;
	for(int i=1;i<N;i++) {
		ans+=mu[i]*(bin[b[i]]-1);
		ans=md(ans);
	}
	cout<<ans<<endl;
}


//容斥
#include <cstdio>
#define maxn 100005
#define ll long long
#define mod 1000000007ll
using namespace std;
int mu[maxn], N, prime[maxn], mark[maxn], cnt[maxn], mi[maxn];
void shai()
{
	int i, j;
	mu[1]=1;
	for(i=2;i<maxn;i++)
	{
		if(!mark[i]){prime[++*prime]=i;mu[i]=-1;}
		for(j=1;i*prime[j]<maxn;j++)
		{
			mark[i*prime[j]]=1;
			if(i%prime[j]==0)break;
			mu[i*prime[j]]=-mu[i];
		}
	}
}
void init()
{
	int i, j, x;
	scanf("%d",&N);
	for(i=1;i<=N;i++)
	{
		scanf("%d",&x);
		for(j=1;j*j<=x;j++)if(x%j==0)cnt[j]++, cnt[x/j]+=j!=x/j;
	}
	mi[0]=1;
	for(i=1;i<maxn;i++)mi[i]=(mi[i-1]<<1)%mod;
}
int main()
{
	ll ans=0;
	init();
	shai();
	for(int i=1;i<maxn;i++)ans=(ans+(mi[cnt[i]]-1)*mu[i])%mod;
	printf("%I64d",(ans+mod)%mod);
	return 0;
}


#include <bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define MOD 1000000007

using namespace std;

typedef long long INT;

typedef pair<int, int> pii;

#define NN 100010

int flag[NN], prime[NN], deg[NN];

int a[NN], fac[NN];

int qf, qb, q[NN], p[NN];

int main() {

	int n;

	scanf("%d", &n);

	for (int i=0; i<n; i++) scanf("%d", a+i);

	sort(a, a+n);

	int np=0;

	for (int i=2; i<NN; i++) {

		if (!flag[i]) flag[i]=i, prime[np++]=i;

		for (int j=0; j<np && i*prime[j]<NN ; j++) {

			flag[i*prime[j]]=prime[j];

			if (i%prime[j]==0) break;

		}

	}

	for (int i=0; i<n; i++) {

		int k=0;

		for (int u=a[i]; u>1; ) {

			int v=flag[u];

			while (u%v==0) u/=v;

			fac[k++]=v;

		}

		qb=qf=0; q[qb++]=1;

		for (int r=0; r<k; r++) {

			int z=qb;

			for (int j=0; j<z; j++) {

				q[qb++]=q[j]*fac[r];

			}

		}

		for (int r=1; r<qb; r++) deg[q[r]]++;

	}

	for (int i=p[0]=1; i<NN; i++) p[i]=2LL*p[i-1]%MOD;

	int ans=p[n]-1;

	for (int i=2; i<NN; i++) {

		if (!deg[i]) continue;

		int k=0;

		for (int u=i; u>1; ) {

			int v=flag[u];

			while (u%v==0) u/=v;

			k++;

		}

		if (k&1) ans-=(p[deg[i]]-1);

		else ans+=(p[deg[i]]-1);

		ans%=MOD;

	}

	if (ans<0) ans+=MOD;

	cout << ans << endl;

	return 0;

}


#pragma comment(linker, ”/STACK:38777216“
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <time.h>
#include <map>
#include <set>

using namespace std;

const int N = 100005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

int n;
int a[N];
int lp[N];
int mark[N];
long long dp[N];
vector <int> pr,G;

void bazm(int x,int &t){
    if(lp[x] == x){
        t *= x;
        G.push_back(x);
    }
}

long long binpow(long long a,long long b){
    if(b == 0)return 1ll;
    if(b % 2)return (a * binpow(a , b - 1)) % mod;
    long long k = binpow(a , b / 2);
    return (k * k) % mod;
}

int get(int x){
    int k = 0;
    for(int j=1;j<=sqrt(x);j++){
        if(x % j != 0)continue;
        if(j == x / j){
            if(lp[j] == j)k++;
        }
        else{
            if(lp[j] == j)k++;
            if(lp[x / j] == x / j)k++;
        }
    }
    return k;
}

void update(){
    int n = (int)G.size();
    for(int i=0;i<(1<<n);i++){
        int nx = 1;
        for(int j=0;j<n;j++) if((i>>j)&1) nx *= G[j];
        dp[nx]++;
        dp[nx] %= mod;
    }
}

int main(){
    //freopen("C-small-attempt0.in","r",stdin);
    //freopen("output.txt","w",stdout);
    for (int i=2; i<=N-5; ++i) {
        if (lp[i] == 0) {
            lp[i] = i;
            pr.push_back (i);
        }
        for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N-5; ++j)
            lp[i * pr[j]] = pr[j];
    }
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    long long answ = 0;
    for(int i=1;i<=n;i++){
        int x = a[i] , nx = 1;
        for(int j=1;j<=sqrt(x);j++){
            if(x % j != 0)continue;
            if(j == x / j)
                bazm(j , nx);
            else{
                bazm(j , nx);
                bazm(x / j , nx);
            }
        }
        update();
        G.clear();
    }
    for(int i=1;i<=N-5;i++){
        if(dp[i] == 0)continue;
        if(get(i) % 2){
            answ -= binpow(2ll , dp[i]) - 1;
            answ += mod;
            answ %= mod;
        }
        else{
            answ += binpow(2ll , dp[i]) - 1;
            answ %= mod;
        }
    }
    cout<<answ<<endl;
    return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;
const int mo=1000000007;
typedef long long ll;
template<typename T>
void read(T &x)
{
	char ch=getchar();
	int f=1;
	for (x=0;ch!='-'&&(ch<'0'||ch>'9');ch=getchar());
	if (ch=='-') f=-1,ch=getchar();
	for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
	x*=f;
}
int n;
int a[100010];
ll cnt[100010];
ll quick_pow(int a,int x)
{
	ll ret=1;
	for (ll sum=a;x;sum=sum*sum%mo,x>>=1)
		if (x&1) ret=ret*sum%mo;
	return ret;
}
int main()
{
	read(n);
	for (int i=1;i<=n;i++)
	{
		read(a[i]);
		cnt[a[i]]++;
	}
	for (int i=1;i<=100000;i++)
		for (int j=i+i;j<=100000;j+=i)
			cnt[i]=(cnt[i]+cnt[j])%mo;
	for (int i=1;i<=100000;i++)
		cnt[i]=(quick_pow(2,cnt[i])-1)%mo;
	for (int i=100000;i>=1;i--)
		for (int j=i+i;j<=100000;j+=i)
			cnt[i]=(cnt[i]-cnt[j])%mo;
	printf("%I64d",(cnt[1]+mo)%mo);
	return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;
const int mo=1000000007;
typedef long long ll;
template<typename T>
void read(T &x)
{
	char ch=getchar();
	int f=1;
	for (x=0;ch!='-'&&(ch<'0'||ch>'9');ch=getchar());
	if (ch=='-') f=-1,ch=getchar();
	for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
	x*=f;
}
int n;
int a[100010];
ll cnt[100010];
ll quick_pow(int a,int x)
{
	ll ret=1;
	for (ll sum=a;x;sum=sum*sum%mo,x>>=1)
		if (x&1) ret=ret*sum%mo;
	return ret;
}
int main()
{
	read(n);
	for (int i=1;i<=n;i++)
	{
		read(a[i]);
		cnt[a[i]]++;
	}
	for (int i=1;i<=100000;i++)
		for (int j=i+i;j<=100000;j+=i)
			cnt[i]+=cnt[j];
	for (int i=1;i<=100000;i++)
		cnt[i]=quick_pow(2,cnt[i])-1;
	for (int i=100000;i>=1;i--)
		for (int j=i+i;j<=100000;j+=i)
			cnt[i]=(cnt[i]-cnt[j])%mo;
	printf("%I64d",cnt[1]);
	return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;

const int Mod=1E9+7;
const int Maxx=100000;
const int Maxn=100005;

int N,M;
int n[Maxn];
int f[Maxn];
int Pow2[Maxn];

int main(){
	#ifndef ONLINE_JUDGE
	freopen("CF 803 F.in","r",stdin),
	freopen("CF 803 F.out","w",stdout);
	#endif
	scanf("%d",&N);
	for(int x,i=1;i<=N;++i)
		scanf("%d",&x),++n[x],M=max(M,x);
	for(int i=1;i<=M;++i)
		for(int j=2;i*j<=M;++j)
			n[i]+=n[i*j];
	Pow2[0]=1;
	for(int i=1;i<=N;++i)
		Pow2[i]=(Pow2[i-1]<<1)%Mod;
	for(int i=M;i>=1;--i){
		f[i]=Pow2[n[i]]-1;
		for(int j=2;i*j<=M;++j)
			f[i]-=f[i*j];
	}
	cout<<f[1];
	return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;

const int Mod=1E9+7;
const int Maxx=100000;
const int Maxn=100005;

int N,M;
int n[Maxn];
int f[Maxn];
int Pow2[Maxn];

int main(){
	#ifndef ONLINE_JUDGE
	freopen("CF 803 F.in","r",stdin),
	freopen("CF 803 F.out","w",stdout);
	#endif
	scanf("%d",&N);
	for(int x,i=1;i<=N;++i)
		scanf("%d",&x),++n[x],M=max(M,x);
	for(int i=1;i<=M;++i)
		for(int j=2;i*j<=M;++j)
			n[i]+=n[i*j];
	Pow2[0]=1;
	for(int i=1;i<=N;++i)
		Pow2[i]=(Pow2[i-1]<<1)%Mod;
	for(int i=M;i>=1;--i){
		f[i]=Pow2[n[i]]-1;
		for(int j=2;i*j<=M;++j)
			f[i]=(f[i]-f[i*j]+Mod)%Mod;
	}
	cout<<f[1];
	return 0;
}


#include<bits/stdc++.h>
#define MX 100001
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

ll cnt[MX], ans[MX], pre[MX];

void preCalc(){
     ll i, j, k;
     ll power=1;
     for(i=0; i<=MX; ++i){
          pre[i]=power-1;
          power=(power*2)%mod;
     }
}

int main(){
     ll i, j, k;
     ll n, tmp;
     preCalc();
     scanf("%lld", &n);
     for(i=0; i<n; ++i){
          scanf("%lld", &k);
          cnt[k]++;
     }
     for(i=MX; i>=1; --i){
          tmp=0;
          for(j=1; j<MX; ++j){
               if(i*j>MX) break;
               tmp+=cnt[i*j];
          }
          tmp=pre[tmp];
          for(j=2; j<MX; ++j){
               if(i*j>MX) break;
               tmp-=ans[i*j];
          }
          ans[i]=tmp;
     }
     printf("%lld\n", ans[1]);
     return 0;
}


#include<bits/stdc++.h>
#define MX 100001
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

ll cnt[MX], ans[MX], pre[MX];

void preCalc(){
     ll i, j, k;
     ll power=1;
     for(i=0; i<=MX; ++i){
          pre[i]=power-1;
          power=(power*2)%mod;
     }
}

int main(){
     ll i, j, k;
     ll n, tmp;
     preCalc();
     scanf("%lld", &n);
     for(i=0; i<n; ++i){
          scanf("%lld", &k);
          cnt[k]++;
     }
     for(i=MX; i>=1; --i){
          tmp=0;
          for(j=1; j<MX; ++j){
               if(i*j>MX) break;
               tmp+=cnt[i*j];
          }
          tmp=pre[tmp];
          for(j=2; j<MX; ++j){
               if(i*j>MX) break;
               tmp=(tmp-ans[i*j]+2*mod)%mod;
          }
          ans[i]=tmp;
     }
     printf("%lld\n", ans[1]);
     return 0;
}


#include <iostream>
#include <vector>
#define MAXN 100100
#define MOD (int) 1e9+7
using namespace std;
int N;
int a[MAXN];
vector<int> primes;
vector<int> factors[MAXN];
int compress[MAXN];
int used[MAXN];
int power[MAXN];
int cur, cur1, ans;
int main()
{
    cin>>N;
    for(int i=0; i<N; i++)
    {
        cin>>a[i];
    }
    for(int i=2; i<MAXN; i++)
    {
        int cur = i; cur1 = 0;
        while(!primes.empty()&&(primes.size()>cur1&&primes[cur1]*primes[cur1]<=cur))
        {
            if(cur%primes[cur1]==0)
            {
                while(cur%primes[cur1]==0)
                {
                    cur = cur/primes[cur1];
                }
                factors[i].push_back(primes[cur1]);
            }
            cur1++;
        }
        if(factors[i].empty())
        {
            primes.push_back(i);
            factors[i].push_back(i);
        }
        if(cur > factors[i][factors[i].size()-1])
        {
            factors[i].push_back(cur);
        }
        compress[i] = 1;
        for(int j=0; j<factors[i].size(); j++)
        {
            compress[i] *= factors[i][j];
        }
    }
    compress[1] = 1;
    for(int i=0; i<N; i++)
    {
        a[i] = compress[a[i]];
    }
    power[0] = 1;
    for(int i=1; i<MAXN; i++)
    {
        power[i] = power[i-1]*2;
        power[i] %= MOD;
    }
    for(int i=0; i<N; i++)
    {
        for(int j=0; j<(1<<(factors[a[i]].size())); j++)
        {
            cur = 1;
            cur1 = j;
            for(int k=factors[a[i]].size()-1; k>=0; k--)
            {
                if(power[k]<=cur1)
                {
                    cur1 -= power[k];
                    cur *= factors[a[i]][k];
                }
            }
            used[cur]++;
        }
    }
    ans = power[N]-1;
    for(int i=2; i<=MAXN; i++)
    {
        if(factors[i].size()%2==1)
        {
            ans += MOD;
            ans -= power[used[i]];
            ans += 1;
        }
        else
        {
            ans += power[used[i]];
            ans -= 1;
        }
        ans %= MOD;
    }
    cout<<ans<<endl;
}


#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const LL MAXN = 1e5 + 23;
LL quick(LL x,LL n)
{
	LL res = 1;
	while (n)
	{
		if (n & 1)res = res*x%MOD;
		n >>= 1;
		x = x*x%MOD;
	}
	return res;
}

LL miu[MAXN], prime[MAXN], total, n;
bool isprime[MAXN];
LL a[MAXN],b[MAXN];
void make()
{
	LL m = MAXN - 3;
	memset(isprime, true, sizeof(isprime));
	isprime[1] = isprime[0] = false;
	total = 0;
	miu[1] = 1;
	miu[0] = 0;
	for (LL i = 2; i <= m; i++)
	{
		if (isprime[i])prime[++total] = i, miu[i] = -1;
		for (int j = 1; j <= total&&prime[j] * i <= m; j++)
		{
			isprime[prime[j] * i] = false;
			if (i%prime[j])miu[i*prime[j]] = -miu[i];
			else { miu[i*prime[j]] = 0; break; }
		}
	}
}

int main()
{
	make();
	while (scanf("%lld", &n) != -1)
	{
		memset(b,0,sizeof(b));
		LL mi = -1;
		for (int i = 0; i<n; i++)scanf("%lld", &a[i]),b[a[i]]++,mi=max(mi,a[i]);
		LL ans = 0;
		for (LL i = 1; i <= mi; i++)
		{
			LL res = 0;
			for (LL j = 1; i*j <= mi; j++)
			{
				res += b[i*j];
			}
			ans += miu[i]*(quick(2, res) - 1);
			ans = (ans%MOD + MOD) % MOD;
		}
		printf("%lld\n",ans);

	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>

#define nn 200010
#define Mod 1000000007
using namespace std;

inline int Read(){
	char c=getchar();int num=0;
	while ('0'>c||c>'9') c=getchar();
	while ('0'<=c&&c<='9') num=num*10+c-'0',c=getchar();
	return(num);
}

int a[nn],b[nn],ma,n,pw[nn];
int main()
{
	n=Read();
	for (int i=1;i<=n;i++) a[i]=Read(),ma=max(ma,a[i]);

	for (int i=1;i<=n;i++) b[a[i]]++;
	for (int i=1;i<=ma;i++)
	for (int j=i+i;j<=ma;j+=i) b[i]+=b[j];

	pw[0]=1;
	for (int i=1;i<=n;i++) pw[i]=pw[i-1]*2ll%Mod;
	for (int i=1;i<=ma;i++) b[i]=pw[b[i]]-1;
	/*
	for (int i=1;i<=ma;i++)
	if (b[i]) printf("%d %d\n",i,b[i]);
	puts("------------");
	*/
	for (int i=ma;i>=1;i--)
	for (int j=i+i;j<=ma;j+=i) b[i]=(b[i]-b[j]+Mod)%Mod;
	/*
	for (int i=1;i<=ma;i++)
	if (b[i]) printf("%d %d\n",i,b[i]);
	*/
	printf("%d\n",b[1]);
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cctype>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <iomanip>
#include <utility>
#include <functional>

using namespace std;

#define mp make_pair
#define pb push_back
#define pf push_front
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep0(i,n) for(register int (i)=0;(i)<(n);++(i))
#define rep(i,st,ed) for(register int (i)=(st);(i)<=(ed);++(i))
#define per(i,ed,st) for(register int (i)=(ed);(i)>=(st);--(i))
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template<typename T> inline T qmin(const T a,const T b) {return a<b?a:b;}
template<typename T> inline T qmax(const T a,const T b) {return a>b?a:b;}
template<typename T> inline void getmin(T &a,const T b) {if(a>b) a=b;}
template<typename T> inline void getmax(T &a,const T b) {if(a<b) a=b;}

inline void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int mod=(int)1e9+7;
const ll linf=(ll)1e17+7;
const int N=1e5+7;

int tot[N],pw2[N],f[N];
int n,maxv;

int main(){
	scanf("%d",&n);
	pw2[0]=1;
	rep(i,1,n){
		pw2[i]=pw2[i-1]<<1;
		if(pw2[i]>=mod) pw2[i]-=mod;
	}
	rep(i,1,n){
		int x;
		scanf("%d",&x);
		++tot[x];
		getmax(maxv,x);
	}
	rep(i,1,maxv){
		for(int j=i;j<=maxv;j+=i) f[i]+=tot[j];
		f[i]=pw2[f[i]]-1;
	}
	per(i,maxv,1){
		for(int j=i+i;j<=maxv;j+=i){
			f[i]-=f[j];
			if(f[i]<0) f[i]+=mod;
		}
	}
	printf("%d\n",f[1]);
	return 0;
}


/*
 * test.cpp
 *
 *
 *      Author: Fireworks
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>

using namespace std;

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<double,double> dd;
typedef pair<ii,int> iii;
typedef pair<double,int> di;
long long mod = 1000000007LL;
long long base = 37;
long long large = 1000000000000000000LL;

long long power(long long a,long long x){
	if(x==0LL) return 1LL;
	long long ans = power(a,x/2);
	ans=(ans*ans)%mod;
	if(x%2){
		ans*=a;
		ans%=mod;
	}
	return ans;
}

int main(){

	int sz = 100000;
	vector<vector<int> > adj(sz+1,vector<int>(0,0));
	int n;
	vector<long long> cnt(sz+1,0);
	cin>>n;
	for(int i=0;i<n;i++){
		long long x;
		cin>>x;
		cnt[x]++;
	}

	vector<long long> val(sz+1,0LL);

	for(int i=1;i<=sz;i++){
		for(int j=i*2;j<=sz;j+=i){
			adj[j].push_back(i);
		}
		long long t = 0;
		for(int j=i;j<=sz;j+=i){
			t+=cnt[j];
		}
		val[i]=power(2,t);
		val[i]+=mod-1;
		val[i]%=mod;
	}

	for(int i=sz;i>=1;i--){
		for(int j=0;j<(int)adj[i].size();j++){
			int v = adj[i][j];
			val[v]+=mod-val[i];
			val[v]%=mod;
		}
	}
	cout<<val[1]<<endl;

	/*int totalcase;
	int testcase=0;
	cin>>totalcase;
	ofstream out;
	out.open("result.txt");

	while(totalcase--){
		testcase++;
		out<<"Case #"<<testcase<<": ";
		cout<<testcase<<": "<<endl;

		//GOGOGO

		//END
	}
	out.close();*/

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

const int Maxm = 100005;
const int mod = 1000000007;

int pw2[Maxm];
int n;
int cnt[Maxm], res[Maxm];

int main()
{
	pw2[0] = 1;
	for (int i = 1; i < Maxm; i++)
		pw2[i] = 2ll * pw2[i - 1] % mod;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int a; scanf("%d", &a);
		cnt[a]++;
	}
	for (int i = Maxm - 1; i > 0; i--) {
		int my = 0;
		for (int j = i; j < Maxm; j += i)
			my += cnt[j];
		res[i] = (pw2[my] - 1 + mod) % mod;
		for (int j = i + i; j < Maxm; j += i)
			res[i] = (res[i] - res[j] + mod) % mod;
	}
	printf("%d\n", res[1]);
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pr;
const double pi=acos(-1);
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define Rep(i,u) for(int i=head[u];i;i=Next[i])
#define clr(a) memset(a,0,sizeof a)
#define pb push_back
#define mp make_pair
ld eps=1e-9;
ll pp=1000000007;
ll mo(ll a,ll pp){if(a>=0 && a<pp)return a;a%=pp;if(a<0)a+=pp;return a;}
ll powmod(ll a,ll b,ll pp){ll ans=1;for(;b;b>>=1,a=mo(a*a,pp))if(b&1)ans=mo(ans*a,pp);return ans;}
ll read(){
	ll ans=0;
	char last=' ',ch=getchar();
	while(ch<'0' || ch>'9')last=ch,ch=getchar();
	while(ch>='0' && ch<='9')ans=ans*10+ch-'0',ch=getchar();
	if(last=='-')ans=-ans;
	return ans;
}
//head
#define N 110000
int n,a[N],b[N],B[N];
int main(){
	n=read();
	rep(i,1,n)a[read()]++;
	B[0]=1;
	rep(i,1,n)B[i]=B[i-1]*2%pp;
	rep(i,1,100000)
		for(int j=i;j<=100000;j+=i)b[i]+=a[j];
//	rep(i,1,3)printf("%d\n",b[i]);
	rep(i,1,100000)b[i]=(B[b[i]]-1+pp)%pp;
//	rep(i,1,3)printf("%d\n",b[i]);
	per(i,100000,1){
		for(int j=i+i;j<=100000;j+=i){
			b[i]=b[i]-b[j];
			if(b[i]<0)b[i]+=pp;
		}
	}
	cout<<b[1]<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,j,k) for(int i=(int)j;i<=(int)k;i++)
#define per(i,j,k) for(int i=(int)j;i>=(int)k;i--)
using namespace std;
typedef long long LL;
const int P=1000000007;
const int N=100005;
inline int Pow(int a,int b){
    int c=1;
    for(;b;b>>=1,a=a*1ll*a%P)if(b&1)c=c*1ll*a%P;
    return c;
}
int p[N],miu[N];
int n,a[N];
int cnt[N];
const int S=100000;
int main(){
    scanf("%d",&n);
    rep(i,1,n)scanf("%d",&a[i]);
    rep(i,1,n)cnt[a[i]]++;

    rep(i,2,S)if(!p[i])for(int j=i;j<=S;j+=i)if(!p[j])p[j]=i;
    miu[1]=1;
    rep(i,2,S)if((i/p[i])%p[i]==0)miu[i]=0;else miu[i]=P-miu[i/p[i]];
    int ans=0;
    rep(i,1,S){
        int w=0;
        for(int j=i;j<=S;j+=i)w+=cnt[j];
        ans=(ans+(Pow(2,w)-1)*1ll*miu[i])%P;
    }
    printf("%d\n",ans);
    return 0;
}


#include <algorithm>
#include <cassert>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

#define INF 0x3f3f3f3f
#define INFLL 1000000000000000000ll
#define gc getchar()
#define abs(x) ((x)>0?(x):(-(x)))
#define X first
#define Y second
#define mp(x,y) make_pair((x),(y))
#define eps (1e-8)
#define pb push_back
#define pf(x) ((x)*(x))
#define il inline

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;

ll read()
{
	char c=gc;ll u=0,f=1;
	while(c!='-' && (c<'0' || '9'<c))c=gc;
	if(c=='-'){
		f=-1;
		c=gc;
	}
	while('0'<=c && c<='9'){
		u=u*10+c-'0';
		c=gc;
	}
	return u*f;
}
char readc()
{
	for(;;){
		char c=gc;
		if('A'<=c && c<='Z' || 'a'<=c && c<='z')return c;
	}
}
int read_digit()
{
	for(;;){
		char c=gc;
		if('0'<=c && c<='9')return c-'0';
	}
}
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
template <typename T>inline void updmax(T &a,T b){if(b>a)a=b;}
template <typename T>inline void updmin(T &a,T b){if(b<a)a=b;}
inline void swap(int &a,int &b){int t=a;a=b;b=t;}

inline void fileio(string s){
	if(s=="txt"){
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	}
	else{
		freopen((s+".in").c_str(),"r",stdin);
		freopen((s+".out").c_str(),"w",stdout);
	}
}

#define mod 1000000007

int p2[100010],cnt[100010],f[100010];

int main()
{
	p2[0]=1;
	for(int i=1;i<=100000;i++)p2[i]=p2[i-1]*2%mod;
	int n=read(),m=0;
	while(n--){
		int u=read();
		cnt[u]++;
		updmax(m,u);
	}
	for(int i=1;i<=m;i++){
		for(int j=i;j<=m;j+=i)f[i]+=cnt[j];
		f[i]=p2[f[i]]-1;
	}
	for(int i=m;i>=1;i--){
		for(int j=i+i;j<=m;j+=i)f[i]=(f[i]-f[j])%mod;
	}
	cout<<(f[1]+mod)%mod<<endl;
	return 0;
}


#include <algorithm>
#include <cassert>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

#define INF 0x3f3f3f3f
#define INFLL 1000000000000000000ll
#define gc getchar()
#define abs(x) ((x)>0?(x):(-(x)))
#define X first
#define Y second
#define mp(x,y) make_pair((x),(y))
#define eps (1e-8)
#define pb push_back
#define pf(x) ((x)*(x))
#define il inline

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;

ll read()
{
	char c=gc;ll u=0,f=1;
	while(c!='-' && (c<'0' || '9'<c))c=gc;
	if(c=='-'){
		f=-1;
		c=gc;
	}
	while('0'<=c && c<='9'){
		u=u*10+c-'0';
		c=gc;
	}
	return u*f;
}
char readc()
{
	for(;;){
		char c=gc;
		if('A'<=c && c<='Z' || 'a'<=c && c<='z')return c;
	}
}
int read_digit()
{
	for(;;){
		char c=gc;
		if('0'<=c && c<='9')return c-'0';
	}
}
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
template <typename T>inline void updmax(T &a,T b){if(b>a)a=b;}
template <typename T>inline void updmin(T &a,T b){if(b<a)a=b;}
inline void swap(int &a,int &b){int t=a;a=b;b=t;}

inline void fileio(string s){
	if(s=="txt"){
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	}
	else{
		freopen((s+".in").c_str(),"r",stdin);
		freopen((s+".out").c_str(),"w",stdout);
	}
}

#define mod 1000000007

int p2[100010],cnt[100010],f[10001];

int main()
{
	p2[0]=1;
	for(int i=1;i<=100000;i++)p2[i]=p2[i-1]*2%mod;
	int n=read(),m=0;
	while(n--){
		int u=read();
		cnt[u]++;
		updmax(m,u);
	}
	for(int i=1;i<=m;i++){
		for(int j=i;j<=m;j+=i)f[i]+=cnt[j];
		f[i]=p2[f[i]]-1;
	}
	for(int i=m;i>=1;i--){
		for(int j=i+i;j<=m;j+=i)f[i]=(f[i]-f[j])%mod;
	}
	cout<<(f[1]+mod)%mod<<endl;
	return 0;
}


#include <algorithm>
#include <cassert>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

#define INF 0x3f3f3f3f
#define INFLL 1000000000000000000ll
#define gc getchar()
#define abs(x) ((x)>0?(x):(-(x)))
#define X first
#define Y second
#define mp(x,y) make_pair((x),(y))
#define eps (1e-8)
#define pb push_back
#define pf(x) ((x)*(x))
#define il inline

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;

ll read()
{
	char c=gc;ll u=0,f=1;
	while(c!='-' && (c<'0' || '9'<c))c=gc;
	if(c=='-'){
		f=-1;
		c=gc;
	}
	while('0'<=c && c<='9'){
		u=u*10+c-'0';
		c=gc;
	}
	return u*f;
}
char readc()
{
	for(;;){
		char c=gc;
		if('A'<=c && c<='Z' || 'a'<=c && c<='z')return c;
	}
}
int read_digit()
{
	for(;;){
		char c=gc;
		if('0'<=c && c<='9')return c-'0';
	}
}
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
template <typename T>inline void updmax(T &a,T b){if(b>a)a=b;}
template <typename T>inline void updmin(T &a,T b){if(b<a)a=b;}
inline void swap(int &a,int &b){int t=a;a=b;b=t;}

inline void fileio(string s){
	if(s=="txt"){
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	}
	else{
		freopen((s+".in").c_str(),"r",stdin);
		freopen((s+".out").c_str(),"w",stdout);
	}
}

#define mod 1000000009

int p2[100010],cnt[100010],f[10001];

int main()
{
	p2[0]=1;
	for(int i=1;i<=100000;i++)p2[i]=p2[i-1]*2%mod;
	int n=read(),m=0;
	while(n--){
		int u=read();
		cnt[u]++;
		updmax(m,u);
	}
	for(int i=1;i<=m;i++){
		for(int j=i;j<=m;j+=i)f[i]+=cnt[j];
		f[i]=p2[f[i]]-1;
	}
	for(int i=m;i>=1;i--){
		for(int j=i+i;j<=m;j+=i)f[i]=(f[i]-f[j])%mod;
	}
	cout<<(f[1]+mod)%mod<<endl;
	return 0;
}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define FF first
#define SS second

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 100005;
const int mod = 1000000007;

int mu[N];
LL pw[N];
int X[N];

void pre() {
  rep(i,2,N) mu[i] = 2;
  rep(i,2,N) if(mu[i] == 2) {
    mu[i] = -1;
    for(int j = 2 * i; j < N; j += i) {
      if(mu[j] == 2) mu[j] = 1;
      mu[j] *= -1;
    }

    for(LL j = i * 1LL * i; j < N; j += i * 1LL * i) {
      mu[j] = 0;
    }
  }

  pw[0] = 0;
  rep(i,1,N) {
    pw[i] = (pw[i-1] * 2 + 1) % mod;
  }
}

int main() {
  pre();
  int n;
  S(n);
  rep(i,0,n) {
    int x;
    S(x);
    X[x]++;
  }
  int ans = pw[n];
  rep(i,2,N) if(mu[i]) {
    int cnt = 0;
    for(int j = i; j < N; j += i) cnt += X[j];
    ans += mu[i] * pw[cnt];
    if(ans < 0) ans += mod;
    if(ans >= mod) ans -= mod;
  }
  P(ans);
  return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define maxn 100005
const int M=(int)(1e9)+7;
int a[maxn],f[maxn],p[maxn];
int main()
{
	int i,j,k;
	int n,ma=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&j);
		ma=max(ma,j);
		a[j]++;
	}

	for(i=1;i<=ma;i++)
		for(j=i+i;j<=ma;j+=i)
			a[i]+=a[j];
	p[0]=1;
	for(i=1;i<=n;i++)
		p[i]=p[i-1]*2%M;

	for(i=ma;i>=1;i--){
		f[i]=p[a[i]]-1;
		for(j=i+i;j<=ma;j+=i)
			f[i]=(f[i]-f[j])%M;
		//if(f[i]) printf("%d %d %d\n",i,f[i],p[a[i]]);
	}
	printf("%d",(f[1]+M)%M);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int vis[150000];
int mu[110000];
int prime[110000];
const int maxn=100000;
int cnt[maxn+10];
int n;
long long f[maxn+10];
const long long mod=1e9+7;
void mobius()
{
    mu[1]=1;
    int cnt=0;
    for (int i=2; i<=maxn;i++)
    {
        if (!vis[i])
        {
            prime[cnt++]=i;
            mu[i]=-1;
        }
        for  (int j=0;j<cnt&&i*prime[j]<=maxn;j++)
        {
            vis[i*prime[j]]=1;
            if (i%prime[j]==0)
            {
                mu[i*prime[j]]=0;
                break;
            }
            else mu[i*prime[j]]=-mu[i];
        }
    }
}
long long qpow(long long a,long long b,long long p)
{
    long long res=1;
    while (b)
    {
        if (b&1) res=res*a%p;
        b>>=1;
        a=a*a%p;
    }
    return res;
}
int main()
{
     mobius();
     cin>>n;
     for (int i=0;i<n;i++)
     {
         int a;
         scanf("%d",&a);
         for (int i=1;i*i<=a;i++)
         {
             if (a%i==0)
             {
                 cnt[i]++;
                 if (a/i!=i)
                 {
                     cnt[a/i]++;
                 }
             }
         }
     }
     for (int i=1;i<=maxn;i++) f[i]=(qpow(2,cnt[i],mod)-1+mod)%mod;
     long long ans=0;
     for (int i=1;i<=maxn;i++)
     {
         ans+=(mu[i]*f[i])%mod;
         ans=(ans+mod)%mod;
     }
     cout<<ans<<endl;
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int vis[150000];
int mu[110000];
int prime[110000];
const int maxn=100000;
int cnt[maxn+10];
int n;
long long f[maxn+10];
const long long mod=1e9+7;
void mobius()
{
    mu[1]=1;
    int cnt=0;
    for (int i=2; i<=maxn;i++)
    {
        if (!vis[i])
        {
            prime[cnt++]=i;
            mu[i]=-1;
        }
        for  (int j=0;j<cnt&&i*prime[j]<=maxn;j++)
        {
            vis[i*prime[j]]=1;
            if (i%prime[j]==0)
            {
                mu[i*prime[j]]=0;
                break;
            }
            else mu[i*prime[j]]=-mu[i];
        }
    }
}
long long qpow(long long a,long long b,long long p)
{
    long long res=1;
    while (b)
    {
        if (b&1) res=res*a%p;
        b>>=1;
        a=a*a%p;
    }
    return res;
}
int main()
{
     mobius();
     cin>>n;
     for (int i=0;i<n;i++)
     {
         int a;
         scanf("%d",&a);
         for (int i=1;i*i<=a;i++)
         {
             if (a%i==0)
             {
                 cnt[i]++;
                 if (a/i!=i)
                 {
                     cnt[a/i]++;
                 }
             }
         }
     }
     for (int i=1;i<=maxn;i++) f[i]=(qpow(2,cnt[i],mod)-1+mod)%mod;
     long long ans=0;
     for (int i=1;i<=maxn;i++)
     {
         ans+=(mu[i]*f[i])%mod;
         ans=(ans+mod)%mod;
     }
     printf("%I64d\n",ans);
    return 0;
}


//----------------------JUGNU:LET YOUR LIGHT SHINE---------------------------//
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pf push_front
#define sz size
#define mk make_pair
#define ln length
#define fr(i,a,b) for(i=a;i<b;i++)
#define fre(i,a,b) for(i=a;i<=b;i++)
#define frr(i,a,b) for(i=a;i>=b;i--)
#define sc(a) scanf("%d", &a)
#define sm(a, b) scanf("%d%d", &a, &b)
#define pr(a) printf("%d\n", a)
#define pm(a, b) printf("%d %d\n", a, b)
#define isset(x,i) ((x>>i)&1)
#define MAXN 100005
#define MOD 1000000007LL
#define fastScan ios_base::sync_with_stdio(0); cin.tie(NULL);

#define trace1(x)       cerr << #x << " : " << x << endl;
#define trace2(x, y)    cerr << #x << " : " << x << " | " << #y << " : " << y << endl;
#define trace3(x, y, z) cerr << #x << " : " << x << " | " << #y << " : " << y << " | " << #z << " : " << z << endl;
#define cline cout << "----------------------" << endl;
using namespace std;

int freq[MAXN], divisibleBy[MAXN], dp[MAXN];

inline int add(int x, int y){
	int temp = x + y;
	if(temp >= MOD) temp -= MOD;
	if(temp < 0) temp += MOD;
	return temp;
}

inline int mult(int x, int y){
	ll temp = x * 1LL * y;
	if(temp >= MOD) temp %= MOD;
	return (int)temp;
}

int power(int base, int exponent){
	if(exponent == 0) return 1;
	int temp = power(base, exponent / 2);
	temp = mult(temp, temp);
	if(exponent & 1) return mult(base, temp);
	return temp;
}

void sieve(){
	for(int i = 2; i < MAXN; i++)
		for(int j = i ; j < MAXN; j += i)
			divisibleBy[i] += freq[j];
	return;
}

int solve(int n){
	int result = add(power(2, n), -1), i;
	frr(i, MAXN - 1, 2){
		dp[i] = add(power(2, divisibleBy[i]), -1);
		for(int j = 2 * i; j < MAXN; j += i) dp[i] = add(dp[i], -dp[j]);
		result = add(result, -dp[i]);
	}
	return result;
}

int main()
{
	int i, j, t, n, m, k, l, r, temp, mini, maxi, flag, cnt;
	sc(n);
	fre(i, 1, n){
		sc(k);
		freq[k]++;
	}
	sieve();
	pr(solve(n));
return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#define mod 1000000007
#define maxn 100005
using namespace std;
int n,x,m,cnt[maxn],f[maxn],bin[maxn],sum[maxn];
int main()
{
	scanf("%d",&n);
	bin[0] = 1;
	for(int i = 1; i <= n ; i ++)
	{
		scanf("%d",&x);
		cnt[x] ++;
		m = max(x,m);
		bin[i] = (bin[i-1] << 1)%mod;
	}
	for(int i = m ; i >= 1; i --)
	{
		for(int j = i; j <= m ; j += i)
		{
			sum[i] += cnt[j];
			f[i] = ((f[i] - f[j])%mod + mod)%mod;
		}
		f[i] = ((f[i] + bin[sum[i]] - 1)%mod + mod)%mod;
	}
	printf("%d",f[1]);

}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

#define MOD 1000000007
#define INF 2000000000

using namespace std;

int cnt[100001];
int n;
long long pp[100001];
long long ans[100001];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	pp[0] = 1;
	for (int i = 1; i <= 100000; i++) {
		pp[i] = pp[i - 1] * 2;
		pp[i] %= MOD;
	}
	for (int i = 100000; i >= 1; i--) {
		int all = 0;
		for (int j = 1; j * i <= 100000; j++) {
			all += cnt[i * j];
		}
		ans[i] = pp[all] - 1;
		for (long long j = 2; j * i <= 100000; j++) {
			ans[i] = ans[i] + MOD - ans[i * j];
			ans[i] %= MOD;
		}
	}
	cout << ans[1] << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pc putchar_unlocked
#define gc getchar_unlocked
typedef long long ll;
typedef unsigned long long llu;
#define mp make_pair
#define pb push_back
#define sc(x) scanf("%d",&x)
#define sc2(x,y) scanf("%d%d",&x,&y)
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scl(x) scanf("%lld",&x)
#define scl2(x,y) scanf("%lld%lld",&x,&y)
#define scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define scstr(x) scanf("%s",x)
#define pd(x) printf("%d",x)
#define pstr(x) printf("%s",x)
#define newl() printf("\n")
#define fl(i,n) for (i=0;i<n;i++)
#define fle(i,n) for (i=1;i<=n;i++)
#define fla(i,a,n) for (i=a;i<n;i++)
#define mem(a,i) memset(a,i,sizeof(a))
#define fi first
#define se second
typedef pair<int,int> pii;
typedef pair<int,pair<int,int> > piii ;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
#define gcd __gcd
#define wl(n) while (n--)
#define debug(x) cerr<<"debug->"<<#x<<"::"<<x<<endl
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n"
#define tr(container, it)  for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define all(v) v.begin(),v.end()
#define tatt(cont) typeof(cont.begin())
const double eps=0.000000000000001 ;
#define MOD 1000000007
typedef long double LF;
typedef double lF;
#define hihihaha ((double)CLOCKS_PER_SEC)
#define nl putchar('\n')
//-------------
int A[100010];
int hs[100010];
ll ways[100010];
ll powd(ll a, ll b, ll c)
{
	if (b==0)
		return 1;
	ll ret=powd(a,b/2,c);
	if (b&1)
		return (((a*ret)%c)*ret)%c;
	else
		return (ret*ret)%c;
}// a^b mod c is calculated by this..
int main()
{	//ios::sync_with_stdio(0), cin.tie(0);
	int n,i,j,mx=0;
	sc(n);
	for(i=1;i<=n;i++)
	{	sc(A[i]);
		hs[A[i]]++;
		mx=max(mx,A[i]);
	}
	for (i=1;i<=mx;i++)
	{
		for (j=i;j<=mx;j+=i)
		{
			ways[i]+=hs[j];
		}
		ways[i]=powd(2,ways[i],MOD)-1;
		//debug(ways[i]);
	}
	for (i=mx;i>=1;i--)
	{
		for (j=2*i;j<=mx;j+=i)
		{
			ways[i]-=ways[j];
			ways[i]=(ways[i]%MOD+MOD)%MOD;
		}
	}

	printf("%lld\n",(ways[1]+MOD)%MOD);

	return 0;

}

//01010110 01101100 01100001 01100100 00101110


#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define __ ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
// #define INF 0x7f7f7f7f
#define ull unsigned long long int
#define ll long long
// #define l long
#define se second
#define fi first
#define mk make_pair
#define pb push_back
#define pii pair<int,int>
#define me(u,v,w) make_pair(w,make_pair(u,v));
#define inrange(x,y,row,col) (x>=0 && y>=0 && x<row && y<col)
/*
void bfs(int x,int y){
	memset(vis,false,sizeof(vis));
	queue<pair<int,int> > q;
	level[x][y] = 0;
	q.push(mk(x,y));
	int xx,yy;
	while(!q.empty()){
		xx = q.front().fi;
		yy = q.front().se;
		q.pop();
		if(vis[xx][yy]){
			continue;
		}
		vis[xx][yy] = 1;
		for(int i=0;i<4;++i){
			int nexx = xx + a[i];
			int nexy = yy + b[i];
			if(inrange(nexx,nexy,n,m) && !vis[nexx][nexy] && s[nexx][nexy]!='#'){
				if(s[nexx][nexy]=='.' || s[nexx][nexy]=='S'){
					if(s[nexx][nexy]=='S'){
						maxx = max(maxx,level[xx][yy]+1);
					}
					level[nexx][nexy] = level[xx][yy] + 1;
					q.push(mk(nexx,nexy));
				}
			}
		}
	}
}
*/
//Implementation of segment tree
//Question
/*
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).

You are given an array a of n integers. You have to process two types of queries:

    REPLACE l r — for every replace ai with D(ai);
    SUM l r — calculate .

Print the answer for each SUM query.
*/
/*
#define N 300005
const int M=1e9+7;
const int inf=1e9+7;
int a[1000005],add[N*4];
ll tree[N*4];
void build(int l,int r,int p)
{
    tree[p]=add[p]=0;
    if(l==r){
        scanf("%lld",&tree[p]);
        if(a[tree[p]]==tree[p])add[p]=1;
        return;
    }
    int mid=(l+r)>>1;
    build(l,mid,p<<1);
    build(mid+1,r,p<<1|1);
    tree[p]=tree[p<<1]+tree[p<<1|1];
    if(add[p<<1]&&add[p<<1|1])add[p]=1;
}
void update(int l,int r,int L,int R,int p)
{
    if(L==R){
        tree[p]=a[tree[p]];
        if(a[tree[p]]==tree[p])add[p]=1;//Lazy Prop
        return;
    }
    if(add[p])return;
    int mid=(L+R)>>1;
    if(l<=mid)update(l,r,L,mid,p<<1);
    if(r>mid)update(l,r,mid+1,R,p<<1|1);
    tree[p]=tree[p<<1]+tree[p<<1|1];
    if(add[p<<1]&&add[p<<1|1])add[p]=1;
}
ll query(int l,int r,int L,int R,int p)
{
    if(l<=L&&R<=r)return tree[p];
    int mid=(L+R)>>1;
    ll ans=0;
    if(l<=mid)ans+=query(l,r,L,mid,p<<1);
    if(r>mid)ans+=query(l,r,mid+1,R,p<<1|1);
}
int main()
{
    for(int i=1;i<=1000000;i++)
        for(int j=i;j<=1000000;j+=i)
            a[j]++;
    int n,m;
    scanf("%d%d",&n,&m);
    build(1,n,1);
    while(m--)
    {
        int x,y,op;
        scanf("%d%d%d",&op,&x,&y);
        if(op==1)update(x,y,1,n,1);
        else printf("%lld\n",query(x,y,1,n,1));
    }
    return 0;
}*/
//Solution of F:
//let f(x) be count of number of subsequences divisible by x than f(x) = (2^cnt(x))-1;
//cnt(x) = number of numbers divisible by x in the sequence
//then ans = sigma(1,10^5)(mu(x)*f(x))
//where mu(x) = Mobius Function
//Um_nik's
const int MOD = (int) 1e9+7;
ll x,y;
ll add(ll x,ll y){
	x += y;
	if(x>=MOD)x-=MOD;
	return x;
}
ll sub(ll x,ll y){
	x -= y;
	if(x<0)x+=MOD;
	return x;
}
ll mult(ll x,ll y){
	return (x*y)%MOD;
}
const int N = 100100;
ll a[N];
ll mu[N];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=N;++i){
		a[i] = 1;
	}
	while(n--){
		int x;
		cin>>x;
		a[x] = add(a[x],a[x]);
	}
	for(int x = 1;x<N;++x){
		for(int y = 2*x;y<N;y += x){
			a[x] = mult(a[x],a[y]);
		}
	}
	mu[1] = 1;
	for(int x=1;x<N;++x){
		for(int y=2*x;y<N;y+=x){
			mu[y] = sub(mu[y],mu[x]);
		}
	}
	ll ans = 0;
	for(int i=1;i<N;++i){
		ans = add(ans,mult(mu[i],sub(a[i],1)));
	}
	cout<<ans<<endl;
}


#include<cstdio>
#define mo 1000000007
using namespace std;
const int lim=100000;
int prime[100005],mu[100005];
char vis[100005];
int n;
int a[100005];
int qr(int x,int y)
{
	int t=1;
	for (;y;y>>=1,x=1LL*x*x%mo)
		if (y&1) t=1LL*t*x%mo;
	return t;
}
void init()
{
	mu[1]=1;
	for (int i=2;i<=lim;++i)
	{
		if (!vis[i])
			prime[++prime[0]]=i,
			mu[i]=-1;
		for (int j=1;prime[j]*i<=lim&&j<=prime[0];++j)
		{
			vis[i*prime[j]]=1;
			if (i%prime[j]) mu[i*prime[j]]=-mu[i];
			else break;
		}
	}
}
main()
{
	init();
	scanf("%d",&n);
	for (int x,i=1;i<=n;++i) scanf("%d",&x),++a[x];
	int ans=0;
	for (int i=1;i<=lim;++i)
		if (mu[i])
		{
			int t=0;
			for (int j=i;j<=lim;j+=i) t+=a[j];
			if (!t) continue;
			ans+=mu[i]*(qr(2,t)-1);
			ans%=mo;
		}
	if (ans<0) ans+=mo;
	printf("%d\n",ans);
}


#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#define N 100001
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
#define MOD 1000000007
bool vis[N];
LL p[N],np,f[N],n,s[N],_[N],a,ans;
LL qow(LL x,LL y){return y?(y&1?x*qow(x,y-1)%MOD:qow(x*x%MOD,y/2)):1;}
void pretype()
{
	f[1]=1;
	for(int i=2;i<N;i++)
	  {
	  if(!vis[i])p[++np]=i,f[i]=-1;
	  for(int j=1;j<=np && i*p[j]<N;j++)
	    {
	    vis[i*p[j]]=true;
	    if(i%p[j])f[i*p[j]]=-f[i];
	    else{f[i*p[j]]=0;break;}
		}
	  }
}
int main()
{
	pretype();
	scanf("%I64d",&n);
	for(LL i=1;i<=n;i++)
	  scanf("%I64d",&a),_[a]++;
	for(LL i=1;i<N;i++)
	  for(LL j=i;j<N;j+=i)
	    if(_[j])s[i]+=_[j];
	for(LL i=1;i<N;i++)
	  ans+=f[i]*(qow(2,s[i])+MOD-1)%MOD,ans%=MOD;
	printf("%I64d\n",ans);
	return 0;
}


#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#define N 100001
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
#define MOD 1000000007
bool vis[N];
LL p[N],np,f[N],n,s[N],_[N],a,ans;
LL qow(LL x,LL y){return y?(y&1?x*qow(x,y-1)%MOD:qow(x*x%MOD,y/2)):1;}
void pretype()
{
	f[1]=1;
	for(LL i=2;i<N;i++)
	  {
	  if(!vis[i])p[++np]=i,f[i]=-1;
	  for(LL j=1;j<=np && i*p[j]<N;j++)
	    {
	    vis[i*p[j]]=true;
	    if(i%p[j])f[i*p[j]]=-f[i];
	    else{f[i*p[j]]=0;break;}
		}
	  }
}
int main()
{
	pretype();
	scanf("%I64d",&n);
	for(LL i=1;i<=n;i++)
	  scanf("%I64d",&a),_[a]++;
	for(LL i=1;i<N;i++)
	  for(LL j=i;j<N;j+=i)
	    if(_[j])s[i]+=_[j];
	for(LL i=1;i<N;i++)
	  ans+=((qow(2,s[i])+MOD-1)%MOD)*f[i],ans%=MOD;
	printf("%I64d\n",ans);
	return 0;
}


#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#define N 100001
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
#define MOD 1000000007
bool vis[N];
LL p[N],np,f[N],n,s[N],_[N],a,ans;
LL qow(LL x,LL y){return y?(y&1?x*qow(x,y-1)%MOD:qow(x*x%MOD,y/2)):1;}
void pretype()
{
	f[1]=1;
	for(LL i=2;i<N;i++)
	  {
	  if(!vis[i])p[++np]=i,f[i]=-1;
	  for(LL j=1;j<=np && i*p[j]<N;j++)
	    {
	    vis[i*p[j]]=true;
	    if(i%p[j])f[i*p[j]]=-f[i];
	    else{f[i*p[j]]=0;break;}
		}
	  }
}
int main()
{
	pretype();
	scanf("%I64d",&n);
	for(LL i=1;i<=n;i++)
	  scanf("%I64d",&a),_[a]++;
	for(LL i=1;i<N;i++)
	  for(LL j=i;j<N;j+=i)
	    if(_[j])s[i]+=_[j];
	for(LL i=1;i<N;i++)
	  ans+=((qow(2,s[i])+MOD-1)%MOD)*f[i]+MOD,ans%=MOD;
	return printf("%I64d\n",ans),0;
}


#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#define N 100001
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
#define MOD 1000000007
bool vis[N];
LL p[N],np,f[N],n,s[N],_[N],a,ans;
LL qow(LL x,LL y){return y?(y&1?x*qow(x,y-1)%MOD:qow(x*x%MOD,y/2)):1;}
void pretype()
{
	f[1]=1;
	for(int i=2;i<N;i++)
	  {
	  if(!vis[i])p[++np]=i,f[i]=-1;
	  for(int j=1;j<=np && i*p[j]<N;j++)
	    {
	    vis[i*p[j]]=true;
	    if(i%p[j])f[i*p[j]]=-f[i];
	    else{f[i*p[j]]=0;break;}
		}
	  }
}
int main()
{
	pretype();
	scanf("%I64d",&n);
	for(LL i=1;i<=n;i++)
	  scanf("%I64d",&a),_[a]++;
	for(LL i=1;i<N;i++)
	  for(LL j=i;j<N;j+=i)
	    if(_[j])s[i]+=_[j];
	for(LL i=1;i<N;i++)
	  ans+=f[i]*qow(2,s[i])-f[i],ans%=MOD;
	printf("%I64d\n",ans);
	return 0;
}


//   Author:Arturia
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cctype>
#include<ctime>
#include<cstdlib>
#include<string>
#include<queue>
#include<cmath>
#include<set>
#include<map>
#include<bitset>
#include<vector>
#define rep(x,a,b) for (int x=a;x<=(int)(b);x++)
#define drp(x,a,b) for (int x=a;x>=(int)(b);x--)
#define cross(x,a) for (int x=hd[a];~x;x=nx[x])
#define ll long long
#define inf (1<<29)
#define pii pair<int,int>
#define pdd pair<double,double>
#define mk(a,b) make_pair(a,b)
#define fs first
#define sc second
#define pb push_back
#define VI vector<int>
#define VS vector<string>
using namespace std;
inline ll rd(){
	ll x=0;int ch=getchar(),f=1;
	while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();
	if (ch=='-'){f=-1;ch=getchar();}
	while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}
inline void rt(ll x){
	if (x<0) putchar('-'),x=-x;
	if (x>=10) rt(x/10),putchar(x%10+'0');
		else putchar(x+'0');
}
const int maxn=100005,p=1000000007;
int miu[maxn],mn[maxn],prm[maxn],pc;
int a[maxn],pw[maxn],n,cnt[maxn];
int main(){
	miu[1]=1;
	rep(i,2,100000){
		if (!mn[i]) prm[mn[i]=++pc]=i,miu[i]=-1;
		rep(j,1,mn[i]){
			int k=i*prm[j];
			if (k>100000) break;
			mn[k]=j;
			if (j==mn[i]) miu[k]=0;else miu[k]=-miu[i];
		}
	}
	n=rd();
	rep(i,1,n) a[i]=rd();
	rep(i,1,n){
		for (int j=1;j*j<=a[i];j++) if (a[i]%j==0){
			cnt[j]++;
			if (j!=a[i]/j) cnt[a[i]/j]++;
		}
	}
	pw[0]=0;
	rep(i,1,100000) pw[i]=(pw[i-1]*2+1)%p;
	int ans=0;
	rep(i,1,100000) ans=(pw[cnt[i]]*miu[i]+ans)%p;
	ans=(ans+p)%p;
	rt(ans),putchar('\n');
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef pair<double, double> pdd;
typedef pair<string, int> psi;

const int MOD = 1e9 + 7;

const ll oo = 1e15;

typedef long long ll;

const int N = 2e5+20;

ll fastPow(ll a , ll b){
	if(!b)
		return 1ll;
	ll res = fastPow(a,b/2);
	res %= MOD;
	res = (res * res)%MOD;
	if(b&1)
		return (res * a)%MOD;
	return res;
}
ll gcd(ll a , ll b){
	return !b ? a : gcd(b,a%b);
}
int n,a[N];

ll add[N];

ll freq[N];

vector<int> dv[N];

int main() {
 	//freopen("input.txt","r",stdin);
 	scanf("%d",&n);
 	for (int i = 1 ; i <= n; ++i){
 		scanf("%d",&a[i]);
 		freq[a[i]]++;
 	}
 	for(int i = 2; i <= 100000 ; i++)
 		for(int j = i ; j <= 100000;j+= i){
 			dv[j].push_back(i);
 		}

 	ll res = (fastPow(2ll,n)-1+MOD)%MOD;
 	for(int i = 100000 ; i >= 2; i--){
 		ll me = 0;
 		for(int j = i; j <= 100000 ; j+= i){
 			if(freq[j] == 0)
 				continue;
 			me += freq[j];
 		}
 		add[i] += fastPow(2ll,me)-1;
 		add[i] %= MOD;
 		res -= add[i];
 		if(res < 0)
 			res += MOD;
 		for(int u = 0 ; u < dv[i].size();u++){
 			int cur = dv[i][u];
 			add[cur] -= add[i];
 			if(add[cur] < 0)
 				add[cur] += MOD;
 		}
 	}

 	printf("%lld\n", res);
	return 0;
}


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

const int64_t mod=1e9+7;

int64_t n,c[100005],f[100005],rs[100005],mul[100005];

int main()
{
    ios_base::sync_with_stdio(false);
    //freopen("803F.INP","r",stdin);
    cin>>n;
    int x;
    mul[0]=1;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        c[x]++;
        mul[i]=mul[i-1]*2%mod;
    }
    for(int i=1;i<=1e5;i++)
        for(int j=i;j<=1e5;j+=i)
            f[i]+=c[j];
    for(int i=1e5;i>=1;i--)
    {
        for(int j=i;j<=1e5;j+=i)
            rs[i]=(rs[i]-rs[j]+mod)%mod;
        rs[i]=(rs[i]+mul[f[i]]-1)%mod;
    }
    cout<<rs[1];
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<ll,ll> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<ll,pair<ll,ll> > iii;
#define PI 3.141592653589793
#define mod (ll)(1000*1000*1000+7)
//# define N 300005
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=((ans%m)*(a%m))%m; b/=2; a=((a%m)*(a%m))%m; } return ans%m; }
# define INF (ll)1e18
# define LG 20
typedef pair<ll,pair<ll,ll> > pii;
# define INF1 (ll)4e9
# define maxn 100005
# define offset 1000005

/*************************************************
struct Coupon {
    ll l;
    ll r;
    ll id;

    Coupon(ll l, ll r, ll id): l(l), r(r), id(id) {} // Initialization

    bool operator<(const Coupon& c) { // Sorting
        return l < c.l;
    }
};

**************************************************/
ll cnt[maxn+2];
ll a[maxn+2];

ll cal(ll pw)
{
  ll val =pow(2LL,pw,mod);
  val-=1;
  val+=mod;
  val%=mod;
  return val;
}

ll ans[maxn+2];

int  main()
{
  IOS;
   ll n;
   cin >> n;
   for(int i=0;i<n;i++)
   {
     cin >> a[i];
     cnt[a[i]]++;
   }

    //trace1(ans1);
   for(int i=1;i<=maxn;i++)
   {
     for(int j=2*i;j<=maxn;j+=i)
     {
       cnt[i]+=cnt[j];
     }
   }

   ll temp=0;
   for(int i=maxn;i>=1;i--)
   {
    //trace1(temp);
    //trace2(i,cnt[i]);
      temp=0;
      temp+= cal(cnt[i]);
      temp%=mod;
      for(int j=2*i;j<=maxn;j+=i)
      {
        //trace2(j,cnt[j]);
         temp-=ans[j];
         temp+=mod;
         temp%=mod;
      }
      ans[i]=temp;
   }

   cout << ans[1];
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <ctime>
#include <map>

#define inf 0x3f3f3f3f
#define Inf 0x3FFFFFFFFFFFFFFFLL
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, n) for (int i = 1; i <= (n); ++i)
#define clr(x, a) memset(x, (a), sizeof x)
using namespace std;
typedef long long ll;
int const N = 100100;
ll const mod = 1000000007LL;
int a[N];

ll powMod(ll a, ll b) {
  ll ret = 1;
  while (b) {
    if (b & 1) {
      ret = ret * a % mod;
    }
    a = a * a % mod;
    b >>= 1;
  }
  return ret;
}
ll cnt[N];
int mo[N];
void init() {
  Rep(i, 100000) {
    int t = i;
    for (int j = 2; j * j <= t; ++j) {
      if (t % j == 0) {
        mo[i] ^= 1;
        while (t % j == 0) t /= j;
      }
    }
    if (t > 1) mo[i] ^= 1;
  }
}
int main() {
  init();
  int n; scanf("%d", &n);
  Rep(i, n) scanf("%d", &a[i]);
  Rep(i, n) {
    int t = a[i];
    ll q = 1;
    for (int j = 2; j * j <= t; ++j) {
      if (t % j == 0) {
        q *= j;
        while (t % j == 0) t /= j;
      }
    }
    q *= t;
    for (int j = 1; j * j <= q; ++j) {
      if (q % j == 0) {
        cnt[j]++;
        if (j * j != q) cnt[q / j]++;
      }
    }
  }
  ll ans = powMod(2, n) - 1;
  for (int i = 2; i <= 100000; ++i) {
    ll t = powMod(2, cnt[i]) - 1;
    if (mo[i]) ans -= t;
    else ans += t;
  }
  ans %= mod; ans += mod; ans %= mod;
  cout << ans << endl;
  return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <ctime>
#include <map>

#define inf 0x3f3f3f3f
#define Inf 0x3FFFFFFFFFFFFFFFLL
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, n) for (int i = 1; i <= (n); ++i)
#define clr(x, a) memset(x, (a), sizeof x)
using namespace std;
typedef long long ll;
int const N = 100100;
ll const mod = 1000000007LL;
int a[N];

ll powMod(ll a, ll b) {
  ll ret = 1;
  while (b) {
    if (b & 1) {
      ret = ret * a % mod;
    }
    a = a * a % mod;
    b >>= 1;
  }
  return ret;
}
ll cnt[N];
int mo[N];
void init() {
  Rep(i, 100000) {
    int t = i;
    for (int j = 2; j * j <= t; ++j) {
      if (t % j == 0) {
        mo[i] ^= 1;
        while (t % j == 0) t /= j;
      }
    }
    if (t > 1) mo[i] ^= 1;
  }
}
int main() {
  init();
  int n; scanf("%d", &n);
  Rep(i, n) scanf("%d", &a[i]);
  Rep(i, n) {
    int t = a[i];
    for (int j = 1; j * j <= t; ++j) {
      if (t % j == 0) {
        ++cnt[j];
        if (j * j != t) ++cnt[t / j];
      }
    }
  }
  ll ans = powMod(2, n) - 1;
  for (int i = 2; i <= 100000; ++i) {
    ll t = powMod(2, cnt[i]) - 1;
    if (mo[i]) ans -= t;
    else ans += t;
  }
  ans %= mod; ans += mod; ans %= mod;
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
const int mod = 1e9+7;
int dp[N],a[N],cnt[N],pw2[N];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        cnt[a[i]]++;
    }
    pw2[0]=1;
    for(int i=1;i<N;i++)
    {
        pw2[i]=(pw2[i-1]*2)%mod;
    }

    for(int g=N;g>=1;g--)
    {
        int tot = 0;
        for(int i=g;i<N;i+=g)
        {
            tot+=(cnt[i]);
        }
        long long val = pw2[tot]-1;
        for(int i=g+g;i<N;i+=g)
        {
            val-=dp[i];
        }
        dp[g]=(val%mod+mod)%mod;
    }
    cout<<dp[1]<<endl;

}


#include<bits/stdc++.h>

#define MOD 1000000007
#define MAX 100005
#define ll long long
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define ss(x) scanf("%s",x)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define vpii vector<pii >
#define vll vector<ll>
#define clr(x) memset(x,0,sizeof(x))

#define FILEIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);

using namespace std;

ll power(ll a,ll b,ll m){
	ll x=1%m; a%=m;
	while(b){
		if((1&b)) x = x * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return x;
}

int smpf[MAX];

void SMPF(){
	for(int i=1;i<MAX;i++) smpf[i]=i;

	for(int i=2;i<MAX;i+=2) smpf[i]=2;

	for(int i=3;i*i<MAX;i+=2){
		if(smpf[i]==i){
			for(int j=i*i;j<MAX;j+=2*i){
				if(smpf[j]==j){
					smpf[j]=i;
				}
			}
		}
	}
}

// call SMPF first
int mobius[MAX];
void pre_mu(){
	clr(mobius);
	mobius[1]=1;
	for(int i=2;i<MAX;i++){
		if(smpf[i]!=smpf[i/smpf[i]]){
			mobius[i]=-mobius[i/smpf[i]];
		}
	}
}

int cnt[MAX];

int main(){
	SMPF();
	pre_mu();
	int n;sd(n);
	clr(cnt);
	for(int i=1;i<=n;i++){
		int x;sd(x);
		cnt[x]++;
	}
	for(int i=1;i<MAX;i++){
		for(int j=2*i;j<MAX;j+=i){
			cnt[i]+=cnt[j];
		}
	}
	ll ans=0;
	for(int i=1;i<MAX;i++){
		if(mobius[i]==0) continue;
		ans+=(mobius[i]*(power(2,cnt[i],MOD)-1+MOD)%MOD);
	}
	ans%=MOD;
	if(ans<0) ans+=MOD;
	plld(ans);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
#define M 1000000007
#define N 100010
int x,i,j,k,n,m,f[N],S,Ma,Ans,mu[N],p[N],Cnt;
bool b[N];
inline int Max(int x,int y){return x<y?y:x;}
inline int Pow(int x,int y){
	if(y==0)return 1;
	int Ans=Pow(x,y>>1);
	Ans=1ll*Ans*Ans%M;
	if(y&1)return 1ll*Ans*x%M;
	return Ans;
}
inline void Init(){
	mu[1]=1;
	for(i=2;i<=Ma;i++){
		if(!b[i])p[++Cnt]=i,mu[i]=-1;
		for(j=1;j<=Cnt&&p[j]*i<=Ma;j++){
			b[p[j]*i]=1;
			if(!(i%p[j]))break;
			mu[p[j]*i]=-mu[i];
		}
	}
}
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&x);Ma=Max(Ma,x);
		S=sqrt(x);
		for(j=1;j<=S;j++)
		if(x%j==0){
			f[j]++;
			if(j*j<x)f[x/j]++;
		}
	}
	Init();
	for(i=1;i<=Ma;i++)Ans=(Ans+(Pow(2,f[i])-1)*mu[i])%M;
	printf("%d\n",(Ans+M)%M);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
#define M 1000000007
#define N 100010
int x,i,j,k,n,m,f[N],S,Ma,Ans;
bool s[N];
inline int Max(int x,int y){return x<y?y:x;}
inline int Pow(int x,int y){
	if(y==0)return 1;
	int Ans=Pow(x,y>>1);
	Ans=1ll*Ans*Ans%M;
	if(y&1)return 1ll*Ans*x%M;
	return Ans;
}
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&x);Ma=Max(Ma,x);
		S=sqrt(x);
		for(j=1;j<=S;j++)
		if(x%j==0){
			f[j]++;
			if(j*j<x)f[x/j]++;
		}
	}
	for(i=1;i<=n;i++)
	for(j=1;j*i<=Ma;j++)
	s[j*i]^=1;
	for(i=1;i<=Ma;i++)
	if(f[i])Ans=(Ans+(Pow(2,f[i])-1)*(s[i]?1:-1))%M;
	printf("%d\n",Ans);
	return 0;
}