#include <stdio.h>
#include <math.h>

int calc2(int n){
  int stock[10000],i,k,returnValue;
  i=0;
  while(n>1){
    stock[i]=n%2;
    n=n/2;
   // printf("n=%d,stock[%d]=%d\n",n,i,stock[i]);
    i++;
  }
  stock[i]=n;
  returnValue=0;
  for(k=0;k<=i;k++){
      returnValue+=stock[k]*(double)pow(10.0,(double)k);
  }
  
  return returnValue;
  
}

int getKeta(int a){
  int i=0;
  while(a>0){
    a=a/10;
    i++;
  }
  
  return i;

}

int xor(int a,int b){
  int sum=a+b;
  int length=getKeta(sum);
  int stock[length];
  int i,k;
  int returnValue;
  //printf("sum=%d\n",sum);
  for(i=0;i<=length;i++){
    if(sum%10==0||sum%10==2)
      stock[i]=0;
    else
      stock[i]=1;
    
    sum=sum/10;
  }
  
  returnValue=0;
  for(k=0;k<=length;k++){
      returnValue+=stock[k]*(double)pow(2.0,(double)k);
  }
  
  return returnValue;
  
}

int main(void){
  int N,i,j,sum;
  scanf("%d",&N);
  int a[N];
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
    //printf("a[%d]=%d\n",i,a[i]);
  }
  sum=0;
  for(i=0;i<N-1;i++){
    for(j=i+1;j<N;j++){
     // printf("a[%d],a[%d]\n",i,j);
      //printf("結果:%d\n",xor(calc2(a[i]),calc2(a[j])));
      sum+=xor(calc2(a[i]),calc2(a[j]));
    }
  }
  
  int ans=sum%(10000000+7);
  printf("%d\n",ans);
      
}