#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1 << 29;
const long long MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> as(n, vector<int>(60));
  for (int i = 0; i < (n); ++i) {
    long long a;
    cin >> a;
    for (int j = 0; j < (60); ++j) {
      as[i][j] = a & 1;
      a >>= 1;
    }
  }
  long long ans = 0;
  for (int i = 0; i < (60); ++i) {
    int cnt0 = 0, cnt1 = 0;
    for (int j = 0; j < (n); ++j) {
      if (as[j][i])
        cnt1++;
      else
        cnt0++;
    }
    ans += (long long)cnt0 * cnt1 % MOD * (long long)pow(2, i) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
