#include <bits/stdc++.h>
using namespace std;
long long int a[300001];
int main() {
  int n;
  cin >> n;
  long long int co[60];
  for (int i = 0; i < 60; i++) co[i] = 0;
  for (int i = 1; i <= n; i++) {
    long long int a;
    cin >> a;
    int count = 0;
    while (a) {
      co[count] += a % 2;
      a /= 2;
      count++;
    }
  }
  long long int ret = 0;
  int now = 1;
  for (int i = 0; i < 60; i++) {
    ret = (ret + now * co[i] * (n - co[i])) % 1000000007;
    now = now * 2 % 1000000007;
  }
  cout << ret << endl;
  return 0;
}
