#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  vector<vector<long long int>> v(n, vector<long long int>(61, 0));
  for (int i = 0; i < n; i++) {
    long long int t;
    cin >> t;
    for (int j = 0; j < 61; j++) {
      v[i][j] += t % 2;
      t /= 2;
    }
  }
  long long int res = 0;
  long long int base = 1;
  for (int i = 0; i < 61; i++) {
    long long int c = 0;
    long long int ones = 0;
    long long int zeros = 0;
    for (int j = 0; j < n; j++) {
      if (v[j][i] == 1) {
        ones++;
        c += zeros;
      } else {
        c += ones;
        zeros++;
      }
    }
    res += c * base % mod;
    res %= mod;
    base *= 2;
    base %= mod;
  }
  cout << res << endl;
}
