#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  long long res = 0;
  for (int d = 0; d < (60); d++) {
    int zero = 0;
    int one = 0;
    for (int i = 0; i < (n); i++) {
      if (a[i] & 1LL << d)
        one++;
      else
        zero++;
    }
    long long tmp = powl(2, d);
    tmp %= MOD;
    res += zero * one * tmp;
    res %= MOD;
  }
  cout << res << endl;
}
