#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long keta(long long n) {
  string s = to_string(n);
  long long num = s.size();
  return num;
}
const long long INF = 1LL << 60;
const int dh[4] = {1, 0, -1, 0};
const int dw[4] = {0, 1, 0, -1};
struct Edge {
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
using P = pair<long long, int>;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0LL;
  for (long long bit = 0LL; bit < 60; bit++) {
    long long cnt_0 = 0LL, cnt_1 = 0LL;
    for (int i = 0; i < n; i++) {
      if (a[i] & (1LL << bit))
        cnt_1++;
      else
        cnt_0++;
    }
    long long mul = (1LL << bit) % (1000000007);
    mul *= cnt_0 * cnt_1;
    ans = (ans + mul) % (1000000007);
  }
  cout << ans << endl;
}
