#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const int mx = 200010;
const long long mod = 1e9 + 7;
int main() {
  int n;
  long long ans = 0;
  cin >> n;
  unsigned long long a;
  vector<int> one(60);
  vector<int> zero(60);
  for (int i = (int)(0); i < (int)(n); ++i) {
    cin >> a;
    for (int j = 0; j < 60; j++) {
      if (a >> j & 1) {
        one[j]++;
      } else {
        zero[j]++;
      }
    }
  }
  for (int i = 0; i < 60; i++) {
    ans += one[i] * zero[i] * pow(2, i);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
