#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> v;
  long long int MOD = 1000000007;
  long long int ans = 0;
  vector<long long int> oneNums(61, 0);
  vector<long long int> zeroNums(61, 0);
  for (size_t i = 0; i < N; i++) {
    long long int tmp;
    cin >> tmp;
    for (size_t j = 0; j < 60; j++) {
      if (tmp & 1) {
        oneNums[j]++;
        oneNums[j] %= MOD;
      } else {
        zeroNums[j]++;
        zeroNums[j] %= MOD;
      }
      tmp = tmp >> 1;
    }
  }
  long long tmp1 = 1;
  for (size_t i = 0; i < 60; i++) {
    ans += tmp1 * (oneNums[i] * zeroNums[i]);
    ans %= MOD;
    tmp1 = tmp1 << 1;
    tmp1 %= MOD;
  }
  cout << ans << endl;
}
