#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const long long int LINF = 1LL * INF * INF;
const int MAXN = 2e5 + 10;
const int MAXM = 5e3 + 10;
priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;
long long int A[MAXN];
long long int cal[110];
int main() {
  long long int n, m, k, a, b, x, y, q;
  int sum = 0;
  int cnt = 0;
  int mx = 0;
  int mn = INF;
  long long int cur = 0, idx = -1;
  int tc;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    cur = A[i];
    for (int j = 0; j < 60; j++) {
      cal[j] += (cur & 1);
      cur >>= 1;
    }
  }
  long long int res = 0;
  long long int bi = 1;
  for (int i = 0; i < 60; i++) {
    cur = cal[i] * (n - cal[i]);
    cur %= 1000000007;
    res += (bi * cur);
    res %= 1000000007;
    bi <<= 1;
    if (bi >= 1000000007) bi -= 1000000007;
  }
  cout << res << "\n";
  return 0;
}
