#include <bits/stdc++.h>
using namespace std;
typedef priority_queue<int, vector<int>, greater<int>> spqint;
typedef priority_queue<long long, vector<long long>, greater<long long>> spqll;
typedef priority_queue<int, vector<int>, less<int>> bpqint;
typedef priority_queue<long long, vector<long long>, less<long long>> bpqll;
int INF = 1e9;
int NIL = -1;
long long MOD = 1000000007;
long long LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::chrono::system_clock::time_point start, end;
  start = std::chrono::system_clock::now();
  int n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> pow;
  pow.push_back(1);
  for (int i = 1; i <= 60; i++) {
    int m = (long long)pow.size() - 1;
    pow.push_back(pow[m] * 2 % MOD);
  }
  vector<int> cnt(60, 0);
  for (int i = 0; i < (int)(n); i++) {
    long long a;
    cin >> a;
    stringstream ss;
    ss << bitset<60>(a);
    string s = ss.str();
    for (int j = 0; j < (int)(60); j++) {
      if (s[j] == '0') {
        cnt[60 - j - 1]++;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < (int)(60); i++) {
    long long res;
    res = cnt[i] * (n - cnt[i]) % MOD;
    res *= pow[i];
    res %= MOD;
    ans += res;
    ans %= MOD;
  }
  cout << ans << endl;
  end = std::chrono::system_clock::now();
  auto elapsed =
      std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
          .count();
  return 0;
}
