#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000000 + 7;
int main() {
  int n;
  cin >> n;
  vector<bitset<60>> b(n);
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    b.at(i) = a;
  }
  long long ans = 0;
  long long p = 1;
  for (int i = 0; i < 60; i++) {
    int num1 = 0, num0 = 0;
    for (int j = 0; j < n; j++) {
      if (b.at(j).test(i))
        num1++;
      else
        num0++;
    }
    ans += p * num1 * num0;
    ans %= MOD;
    p *= 2;
    p %= MOD;
  }
  cout << ans << endl;
}
