#include <bits/stdc++.h>
using namespace std;
long long dis[100000] = {};
int main() {
  int n, i, j;
  long long a, tem, res = 0, count[60][2] = {};
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    tem = 1;
    for (j = 0; j < 60; j++) {
      count[j][(int)((tem & a) > 0)]++;
      tem <<= 1;
    }
  }
  tem = 1;
  for (i = 0; i < n; i++) {
    res += ((tem % 1000000007) * (count[i][0] * count[i][1] % 1000000007)) %
           1000000007;
    res %= 1000000007;
    tem <<= 1;
  }
  cout << res;
  return 0;
}
