#include <bits/stdc++.h>
using namespace std;
const int INF = 193499;
int main() {
  vector<int> vc;
  long long int n;
  cin >> n;
  long long int f[n];
  for (int i = 0; i < (int)(n); i++) {
    cin >> f[i];
  }
  long long int dp[61];
  for (int i = 0; i < (int)(61); i++) dp[i] = 0;
  long long int ans;
  ans = 0;
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(61); j++) {
      if (f[i] & (1 << 0)) dp[j] += 1;
      f[i] = f[i] >> 1;
    }
  }
  long long int k = 1000000007;
  long long int t;
  for (int i = 0; i < (int)(61); i++) {
    if (dp[i] != 0) {
      t = (1 << i) % k;
      ans = (ans + (((t * dp[i])) % k) * (n - dp[i])) % k;
    }
  }
  cout << ans << endl;
  return 0;
}
