#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
vector<long> two(61);
void InitTwo() {
  two.at(0) = 1;
  for (int j = 0; j < (int)(60); j++) {
    two.at(j + 1) = 2 * two.at(j);
    two.at(j + 1) %= 1000000007;
  }
}
int main() {
  int n;
  cin >> n;
  InitTwo();
  vector<long> c0(60, 0);
  vector<long> c1(60, 0);
  for (int i = 0; i < (int)(n); i++) {
    long d;
    cin >> d;
    bitset<60> s(d);
    for (int j = 0; j < (int)(60); j++) {
      if (s.test(j))
        c1.at(j)++;
      else
        c0.at(j)++;
    }
  }
  long ans = 0;
  for (int i = 0; i < (int)(60); i++) {
    ans += c0.at(i) * c1.at(i) * two.at(i);
    ans %= 1000000007;
  }
  cout << ans << endl;
}
