#include <bits/stdc++.h>
using namespace std;
const int INF = 1e5;
string s[20];
int h, w;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  long long sum = 0;
  long long cnt[60];
  for (long long i = 0; i < 60; i++) {
    cnt[i] = 0;
  }
  long long ma = 0;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    for (long long j = 0; j < 60; j++) {
      if (x & (1LL << j)) cnt[j]++;
    }
  }
  for (long long i = 0; i < 60; i++) {
    sum += (1LL << i) * cnt[i] * (n - cnt[i]);
    sum %= mod;
  }
  cout << sum % mod << endl;
  return 0;
}
