#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000007;
const long long mod = 1000000007;
const double PI = 3.14159265358979323846;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
long long dig[61];
int main() {
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < (N); i++) cin >> A[i];
  long long ans = 0;
  for (int i = 0; i < (N); i++) {
    int num = A[i];
    int val = 0;
    for (int j = 0; num > 0; j++) {
      if (num % 2 == 1) dig[j]++;
      num /= 2;
    }
  }
  for (int i = 0; i < (60); i++) {
    dig[i] = (dig[i] * (N - dig[i])) % mod;
    long long p = long long(pow(2, i)) % mod;
    ans += (p * dig[i]) % mod;
  }
  cout << ans % mod << endl;
}
