#include <bits/stdc++.h>
using namespace std;
int table[300000][62];
void solv() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    long long int a;
    scanf("%lld", &a);
    for (int d = 0; d < 62; d++) {
      table[i][d] = a % 2;
      a = a / 2;
    }
  }
  int sum[62];
  fill(sum, sum + 62, 0);
  for (int i = 0; i < N; i++) {
    for (int d = 0; d < 62; d++) {
      sum[d] += table[i][d];
    }
  }
  long long int ret = 0;
  for (int i = 0; i < N; i++) {
    long long int base = 1;
    for (int d = 0; d < 62; d++) {
      if (0 == table[i][d]) {
        ret = (ret + base * (long long int)sum[d]) % 1000000007;
      } else {
        ret = (ret + base * (long long int)(N - sum[d])) % 1000000007;
      }
      base = (base * 2) % 1000000007;
    }
  }
  printf("%lld", ret / 2);
  return;
}
int main() {
  FILE *fin = NULL, *fout = NULL;
  solv();
  if (NULL != fin) fclose(fin);
  if (NULL != fout) fclose(fout);
  return 0;
}
