#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vector<vector<int>> dp(n, vector<int>(61, 0));
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(61); j++) {
      if ((a[i] >> j) & 1) dp[i][j] = 1;
    }
  }
  long long ans = 0;
  for (int j = 0; j < (int)(61); j++) {
    int cnt_0 = 0, cnt_1 = 0;
    int cnt = 0;
    for (int i = 0; i < (int)(n); i++) {
      if (dp[i][j] == 0) {
        cnt += cnt_1;
        cnt_0++;
      } else {
        cnt += cnt_0;
        cnt_1++;
      }
    }
    long long p = 1;
    for (int i = 0; i < (int)(j); i++) p *= 2;
    ans = (ans + cnt * p) % 1000000007;
  }
  cout << ans << endl;
}
