#include <bits/stdc++.h>
using namespace std;
using P = pair<long long int, long long int>;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
struct Edge {
  int to;
  long long int weight;
  Edge(int t, long long int w) : to(t), weight(w) {}
};
int N;
long long int a[310000];
int main() {
  cin >> N;
  for (int i = 1; i <= N; ++i) cin >> a[i];
  long long int ans = 0;
  for (int k = 0; k < 63; ++k) {
    long long int mask = 1LL << k;
    int one_num = 0;
    int zero_num = 0;
    for (int i = 1; i <= N; ++i) {
      if (a[i] & mask) {
        one_num += 1;
      } else {
        zero_num += 1;
      }
    }
    long long int tmp = one_num * zero_num;
    for (int i = 1; i <= k; ++i) {
      tmp *= 2;
      tmp %= 1000000007;
    }
    ans += tmp;
    ans %= 1000000007;
  }
  cout << ans << "\n";
}
