#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> v;
  for (int i = (0); i < (int)(N); i++) {
    long long a;
    cin >> a;
    v.push_back(a);
  }
  long long ret = 0;
  for (long long b = 62; b >= 0; b--) {
    map<long long, long long> m;
    for (int i = (0); i < (int)(N); i++) {
      m[(v[i] >> b) & 1]++;
    }
    long long tmp = ((m[0] % MOD) * (m[1] % MOD)) % MOD;
    tmp *= (1LL << b);
    tmp %= MOD;
    ret += tmp;
    ret %= MOD;
  }
  cout << ret << endl;
  return 0;
}
